mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
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:
parent
50bbb55cb0
commit
de039bb341
@ -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
|
||||
|
@ -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:
|
||||
|
@ -120,6 +120,8 @@ public:
|
||||
///
|
||||
LyXCursor const & cursor(BufferView *) const;
|
||||
///
|
||||
virtual bool display() const { return isOpen(); }
|
||||
///
|
||||
bool isOpen() const;
|
||||
///
|
||||
void open(BufferView *);
|
||||
|
@ -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_; }
|
||||
///
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
20
src/text.C
20
src/text.C
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user