mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Re-introduce display() for insets, fixing various bugs
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7940 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
173be73b27
commit
50bbb55cb0
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -274,6 +274,8 @@ public:
|
||||
// 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
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
///
|
||||
~InsetFloat();
|
||||
///
|
||||
virtual bool display() const { return true; }
|
||||
///
|
||||
void write(Buffer const & buf, std::ostream & os) const;
|
||||
///
|
||||
void read(Buffer const & buf, LyXLex & lex);
|
||||
|
@ -28,6 +28,8 @@ 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
|
||||
|
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -219,7 +219,7 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
|
||||
//p.pain.rectangle(x, y - a, w, h, LColor::mathframe);
|
||||
}
|
||||
|
||||
par_->draw(p, x + offset_, y);
|
||||
par_->draw(p, x, y);
|
||||
}
|
||||
|
||||
xo_ = x;
|
||||
@ -276,13 +276,6 @@ void InsetFormula::metrics(MetricsInfo & m, Dimension & dim) const
|
||||
dim.des += 1;
|
||||
}
|
||||
|
||||
if (display()) {
|
||||
offset_ = (m.base.textwidth - dim.wid) / 2;
|
||||
dim.wid = m.base.textwidth;
|
||||
} else {
|
||||
offset_ = 0;
|
||||
}
|
||||
|
||||
dim_ = dim;
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,6 @@ private:
|
||||
|
||||
/// 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_;
|
||||
|
35
src/text.C
35
src/text.C
@ -691,6 +691,21 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
|
||||
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) {
|
||||
@ -716,7 +731,7 @@ pos_type LyXText::rowBreakPoint(ParagraphList::iterator pit,
|
||||
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
|
||||
@ -1445,14 +1460,32 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit,
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user