mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
remove Inset::getParagraphs()
cache 'outermost' inset font git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8192 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2d61ce9b85
commit
8fa8cfb4a3
@ -1,4 +1,14 @@
|
|||||||
|
|
||||||
|
2003-12-03 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* PosIterator.C:
|
||||||
|
* iterators.C:
|
||||||
|
* lyxtext.h:
|
||||||
|
* output_latex.C:
|
||||||
|
* paragraph_funcs.C:
|
||||||
|
* text.C:
|
||||||
|
* text2.C: use Inset::getText instead of Inset::getParagraph
|
||||||
|
|
||||||
2003-12-03 André Pönitz <poenitz@gmx.net>
|
2003-12-03 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* buffer.[Ch]:
|
* buffer.[Ch]:
|
||||||
|
@ -33,12 +33,11 @@ PosIterator & PosIterator::operator++()
|
|||||||
PosIteratorItem & p = stack_.back();
|
PosIteratorItem & p = stack_.back();
|
||||||
|
|
||||||
if (p.pos < p.pit->size()) {
|
if (p.pos < p.pit->size()) {
|
||||||
InsetOld * inset = p.pit->getInset(p.pos);
|
if (InsetOld * inset = p.pit->getInset(p.pos)) {
|
||||||
if (inset) {
|
if (LyXText * text = inset->getText(p.index)) {
|
||||||
ParagraphList * pl = inset->getParagraphs(p.index);
|
ParagraphList & pl = text->paragraphs();
|
||||||
if (pl) {
|
|
||||||
p.index++;
|
p.index++;
|
||||||
stack_.push_back(PosIteratorItem(pl, pl->begin(), 0));
|
stack_.push_back(PosIteratorItem(&pl, pl.begin(), 0));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,10 +85,10 @@ PosIterator & PosIterator::operator--()
|
|||||||
if (q.pos < q.pit->size()) {
|
if (q.pos < q.pit->size()) {
|
||||||
InsetOld * inset = q.pit->getInset(q.pos);
|
InsetOld * inset = q.pit->getInset(q.pos);
|
||||||
if (inset && q.index > 0) {
|
if (inset && q.index > 0) {
|
||||||
ParagraphList *
|
LyXText * text = inset->getText(q.index - 1);
|
||||||
pl = inset->getParagraphs(q.index - 1);
|
BOOST_ASSERT(text);
|
||||||
BOOST_ASSERT(pl);
|
ParagraphList & pl = text->paragraphs();
|
||||||
stack_.push_back(PosIteratorItem(pl, prior(pl->end()), pl->back().size()));
|
stack_.push_back(PosIteratorItem(&pl, prior(pl.end()), pl.back().size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@ -156,7 +155,8 @@ int distance(PosIterator const & cur, PosIterator const & end)
|
|||||||
{
|
{
|
||||||
PosIterator p = cur;
|
PosIterator p = cur;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (; p != end; ++p, ++count);
|
for (; p != end; ++p, ++count)
|
||||||
|
;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
|
||||||
|
2003-12-03 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* inset.h: remove getParagraphs()
|
||||||
|
|
||||||
|
* insetcollapsable.[Ch]:
|
||||||
|
* insetert.[Ch]:
|
||||||
|
* insetnote.[Ch]:
|
||||||
|
* insettabular.[Ch]:
|
||||||
|
* insettext.C: use getText() instead of getParagraphs()
|
||||||
|
|
||||||
2003-12-03 Martin Vermeer <martin.vermeer@hut.fi>
|
2003-12-03 Martin Vermeer <martin.vermeer@hut.fi>
|
||||||
|
|
||||||
* insetert.C: fix label text updating bug
|
* insetert.C: fix label text updating bug
|
||||||
|
@ -25,7 +25,6 @@ class LColor_color;
|
|||||||
class FuncRequest;
|
class FuncRequest;
|
||||||
class OutputParams;
|
class OutputParams;
|
||||||
class LyXCursor;
|
class LyXCursor;
|
||||||
class LyXFont;
|
|
||||||
class LyXLex;
|
class LyXLex;
|
||||||
class LyXText;
|
class LyXText;
|
||||||
class Painter;
|
class Painter;
|
||||||
@ -223,10 +222,7 @@ public:
|
|||||||
/// returns the actual scroll-value
|
/// returns the actual scroll-value
|
||||||
virtual int scroll(bool recursive = true) const;
|
virtual int scroll(bool recursive = true) const;
|
||||||
|
|
||||||
/// if this insets owns paragraphs (f.ex. InsetText) then it
|
/// if this insets owns text cells (e.g. InsetText) return cell num
|
||||||
/// should return it's very first one!
|
|
||||||
virtual ParagraphList * getParagraphs(int /*num*/) const { return 0; }
|
|
||||||
///
|
|
||||||
virtual LyXText * getText(int /*num*/) const { return 0; }
|
virtual LyXText * getText(int /*num*/) const { return 0; }
|
||||||
///
|
///
|
||||||
virtual int numParagraphs() const { return 0; }
|
virtual int numParagraphs() const { return 0; }
|
||||||
@ -256,8 +252,6 @@ public:
|
|||||||
be closed before generating this inset. This is needed for
|
be closed before generating this inset. This is needed for
|
||||||
insets that may contain several paragraphs */
|
insets that may contain several paragraphs */
|
||||||
virtual bool noFontChange() const { return false; }
|
virtual bool noFontChange() const { return false; }
|
||||||
//
|
|
||||||
virtual void getDrawFont(LyXFont &) const {}
|
|
||||||
|
|
||||||
/// mark the inset contents as erased (for change tracking)
|
/// mark the inset contents as erased (for change tracking)
|
||||||
virtual void markErased() {}
|
virtual void markErased() {}
|
||||||
|
@ -375,12 +375,6 @@ int InsetCollapsable::scroll(bool recursive) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ParagraphList * InsetCollapsable::getParagraphs(int i) const
|
|
||||||
{
|
|
||||||
return inset.getParagraphs(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int InsetCollapsable::numParagraphs() const
|
int InsetCollapsable::numParagraphs() const
|
||||||
{
|
{
|
||||||
return inset.numParagraphs();
|
return inset.numParagraphs();
|
||||||
|
@ -99,8 +99,6 @@ public:
|
|||||||
///
|
///
|
||||||
void scroll(BufferView *bv, int offset) const;
|
void scroll(BufferView *bv, int offset) const;
|
||||||
///
|
///
|
||||||
ParagraphList * getParagraphs(int) const;
|
|
||||||
///
|
|
||||||
int numParagraphs() const;
|
int numParagraphs() const;
|
||||||
///
|
///
|
||||||
LyXText * getText(int) const;
|
LyXText * getText(int) const;
|
||||||
|
@ -385,12 +385,10 @@ int InsetERT::docbook(Buffer const &, ostream & os,
|
|||||||
|
|
||||||
void InsetERT::edit(BufferView * bv, bool left)
|
void InsetERT::edit(BufferView * bv, bool left)
|
||||||
{
|
{
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined)
|
||||||
inset.edit(bv, left);
|
inset.edit(bv, left);
|
||||||
} else {
|
else
|
||||||
InsetCollapsable::edit(bv, left);
|
InsetCollapsable::edit(bv, left);
|
||||||
}
|
|
||||||
setLatexFont(bv);
|
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,9 +398,6 @@ InsetERT::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
|||||||
{
|
{
|
||||||
BufferView * bv = cmd.view();
|
BufferView * bv = cmd.view();
|
||||||
|
|
||||||
if (inset.paragraphs().begin()->empty())
|
|
||||||
setLatexFont(bv);
|
|
||||||
|
|
||||||
switch (cmd.action) {
|
switch (cmd.action) {
|
||||||
|
|
||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
@ -428,17 +423,6 @@ InsetERT::priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
|||||||
bv->owner()->setLayout(inset.paragraphs().begin()->layout()->name());
|
bv->owner()->setLayout(inset.paragraphs().begin()->layout()->name());
|
||||||
return DispatchResult(true);
|
return DispatchResult(true);
|
||||||
|
|
||||||
case LFUN_BREAKPARAGRAPH:
|
|
||||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
|
||||||
case LFUN_BACKSPACE:
|
|
||||||
case LFUN_BACKSPACE_SKIP:
|
|
||||||
case LFUN_DELETE:
|
|
||||||
case LFUN_DELETE_SKIP:
|
|
||||||
case LFUN_DELETE_LINE_FORWARD:
|
|
||||||
case LFUN_CUT:
|
|
||||||
setLatexFont(bv);
|
|
||||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
|
||||||
}
|
}
|
||||||
@ -459,25 +443,20 @@ bool InsetERT::insetAllowed(InsetOld::Code code) const
|
|||||||
|
|
||||||
void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
|
void InsetERT::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
|
LyXFont tmpfont = mi.base.font;
|
||||||
|
getDrawFont(mi.base.font);
|
||||||
InsetCollapsable::metrics(mi, dim);
|
InsetCollapsable::metrics(mi, dim);
|
||||||
|
mi.base.font = tmpfont;
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::draw(PainterInfo & pi, int x, int y) const
|
void InsetERT::draw(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
|
LyXFont tmpfont = pi.base.font;
|
||||||
|
getDrawFont(pi.base.font);
|
||||||
InsetCollapsable::draw(pi, x, y);
|
InsetCollapsable::draw(pi, x, y);
|
||||||
}
|
pi.base.font = tmpfont;
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::setLatexFont(BufferView * /*bv*/)
|
|
||||||
{
|
|
||||||
#ifdef SET_HARD_FONT
|
|
||||||
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
|
|
||||||
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
|
||||||
font.setColor(LColor::latex);
|
|
||||||
inset.text_.setFont(bv, font, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,8 +98,6 @@ private:
|
|||||||
void init();
|
void init();
|
||||||
///
|
///
|
||||||
void setButtonLabel() const;
|
void setButtonLabel() const;
|
||||||
///
|
|
||||||
void setLatexFont(BufferView *);
|
|
||||||
/// update status on button
|
/// update status on button
|
||||||
void updateStatus(bool = false) const;
|
void updateStatus(bool = false) const;
|
||||||
///
|
///
|
||||||
|
@ -111,18 +111,6 @@ void InsetNote::setButtonLabel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetNote::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
||||||
{
|
|
||||||
InsetCollapsable::metrics(mi, dim);
|
|
||||||
// Contrary to Greyedout, these cannot be construed as part of the
|
|
||||||
// running text: make them stand on their own
|
|
||||||
if (params_.type == "Note" || params_.type == "Comment")
|
|
||||||
if (isOpen())
|
|
||||||
dim.wid = mi.base.textwidth;
|
|
||||||
dim_ = dim;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool InsetNote::showInsetDialog(BufferView * bv) const
|
bool InsetNote::showInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
InsetNoteMailer("note", const_cast<InsetNote &>(*this)).showDialog(bv);
|
InsetNoteMailer("note", const_cast<InsetNote &>(*this)).showDialog(bv);
|
||||||
|
@ -31,8 +31,6 @@ struct InsetNoteParams {
|
|||||||
class InsetNote : public InsetCollapsable {
|
class InsetNote : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
InsetNote(BufferParams const &, std::string const &);
|
InsetNote(BufferParams const &, std::string const &);
|
||||||
/// Copy constructor
|
/// Copy constructor
|
||||||
InsetNote(InsetNote const &);
|
InsetNote(InsetNote const &);
|
||||||
@ -50,22 +48,20 @@ public:
|
|||||||
void read(Buffer const & buf, LyXLex & lex);
|
void read(Buffer const & buf, LyXLex & lex);
|
||||||
///
|
///
|
||||||
void setButtonLabel();
|
void setButtonLabel();
|
||||||
///
|
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
|
||||||
/// show the note dialog
|
/// show the note dialog
|
||||||
bool showInsetDialog(BufferView * bv) const;
|
bool showInsetDialog(BufferView * bv) const;
|
||||||
///
|
///
|
||||||
int latex(Buffer const &, std::ostream &,
|
int latex(Buffer const &, std::ostream &,
|
||||||
OutputParams const &) const;
|
OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int linuxdoc(Buffer const &, std::ostream &,
|
int linuxdoc(Buffer const &, std::ostream &,
|
||||||
OutputParams const &) const;
|
OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int docbook(Buffer const &, std::ostream &,
|
int docbook(Buffer const &, std::ostream &,
|
||||||
OutputParams const &) const;
|
OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int plaintext(Buffer const &, std::ostream &,
|
int plaintext(Buffer const &, std::ostream &,
|
||||||
OutputParams const &) const;
|
OutputParams const &) const;
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
///
|
///
|
||||||
|
@ -1965,14 +1965,6 @@ void InsetTabular::getSelection(int & srow, int & erow,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ParagraphList * InsetTabular::getParagraphs(int i) const
|
|
||||||
{
|
|
||||||
return i < tabular.getNumberOfCells()
|
|
||||||
? tabular.getCellInset(i).getParagraphs(0)
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int InsetTabular::numParagraphs() const
|
int InsetTabular::numParagraphs() const
|
||||||
{
|
{
|
||||||
return tabular.getNumberOfCells();
|
return tabular.getNumberOfCells();
|
||||||
|
@ -125,18 +125,16 @@ public:
|
|||||||
/// Appends \c list with all labels found within this inset.
|
/// Appends \c list with all labels found within this inset.
|
||||||
void getLabelList(Buffer const &, std::vector<std::string> & list) const;
|
void getLabelList(Buffer const &, std::vector<std::string> & list) const;
|
||||||
///
|
///
|
||||||
int scroll(bool recursive=true) const;
|
int scroll(bool recursive = true) const;
|
||||||
///
|
///
|
||||||
void scroll(BufferView *bv, float sx) const {
|
void scroll(BufferView * bv, float sx) const {
|
||||||
UpdatableInset::scroll(bv, sx);
|
UpdatableInset::scroll(bv, sx);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
void scroll(BufferView *bv, int offset) const {
|
void scroll(BufferView * bv, int offset) const {
|
||||||
UpdatableInset::scroll(bv, offset);
|
UpdatableInset::scroll(bv, offset);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
ParagraphList * getParagraphs(int) const;
|
|
||||||
///
|
|
||||||
int numParagraphs() const;
|
int numParagraphs() const;
|
||||||
///
|
///
|
||||||
LyXText * getText(int) const;
|
LyXText * getText(int) const;
|
||||||
|
@ -176,14 +176,16 @@ void InsetText::read(Buffer const & buf, LyXLex & lex)
|
|||||||
void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
|
void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
//lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl;
|
//lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl;
|
||||||
mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
|
|
||||||
setViewCache(mi.base.bv);
|
setViewCache(mi.base.bv);
|
||||||
|
mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
|
||||||
text_.metrics(mi, dim);
|
text_.metrics(mi, dim);
|
||||||
dim.asc += TEXT_TO_INSET_OFFSET;
|
dim.asc += TEXT_TO_INSET_OFFSET;
|
||||||
dim.des += TEXT_TO_INSET_OFFSET;
|
dim.des += TEXT_TO_INSET_OFFSET;
|
||||||
dim.wid += 2 * TEXT_TO_INSET_OFFSET;
|
dim.wid += 2 * TEXT_TO_INSET_OFFSET;
|
||||||
mi.base.textwidth += 2 * TEXT_TO_INSET_OFFSET;
|
mi.base.textwidth += 2 * TEXT_TO_INSET_OFFSET;
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
|
font_ = mi.base.font;
|
||||||
|
text_.font_ = mi.base.font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,9 +272,8 @@ extern LCursor theTempCursor;
|
|||||||
void InsetText::edit(BufferView * bv, bool left)
|
void InsetText::edit(BufferView * bv, bool left)
|
||||||
{
|
{
|
||||||
lyxerr << "InsetText: edit left/right" << endl;
|
lyxerr << "InsetText: edit left/right" << endl;
|
||||||
setViewCache(bv);
|
|
||||||
|
|
||||||
old_par = -1;
|
old_par = -1;
|
||||||
|
setViewCache(bv);
|
||||||
|
|
||||||
if (left)
|
if (left)
|
||||||
text_.setCursorIntern(0, 0);
|
text_.setCursorIntern(0, 0);
|
||||||
@ -289,6 +290,7 @@ void InsetText::edit(BufferView * bv, int x, int y)
|
|||||||
{
|
{
|
||||||
lyxerr << "InsetText::edit xy" << endl;
|
lyxerr << "InsetText::edit xy" << endl;
|
||||||
old_par = -1;
|
old_par = -1;
|
||||||
|
|
||||||
sanitizeEmptyText(bv);
|
sanitizeEmptyText(bv);
|
||||||
text_.setCursorFromCoordinates(x - text_.xo_, y + bv->top_y()
|
text_.setCursorFromCoordinates(x - text_.xo_, y + bv->top_y()
|
||||||
- text_.yo_);
|
- text_.yo_);
|
||||||
@ -534,12 +536,6 @@ void InsetText::clearInset(Painter & pain, int x, int y) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ParagraphList * InsetText::getParagraphs(int i) const
|
|
||||||
{
|
|
||||||
return (i == 0) ? const_cast<ParagraphList*>(¶graphs()) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LyXText * InsetText::getText(int i) const
|
LyXText * InsetText::getText(int i) const
|
||||||
{
|
{
|
||||||
return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
|
return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
|
||||||
@ -577,13 +573,6 @@ void InsetText::collapseParagraphs(BufferView * bv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::getDrawFont(LyXFont & font) const
|
|
||||||
{
|
|
||||||
if (owner())
|
|
||||||
owner()->getDrawFont(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
|
void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
|
||||||
{
|
{
|
||||||
#warning FIXME Check if Changes stuff needs changing here. (Lgb)
|
#warning FIXME Check if Changes stuff needs changing here. (Lgb)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "updatableinset.h"
|
#include "updatableinset.h"
|
||||||
#include "ParagraphList_fwd.h"
|
#include "ParagraphList_fwd.h"
|
||||||
#include "RowList_fwd.h"
|
#include "RowList_fwd.h"
|
||||||
|
#include "lyxfont.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
|
||||||
#include "support/types.h"
|
#include "support/types.h"
|
||||||
@ -125,8 +126,6 @@ public:
|
|||||||
UpdatableInset::scroll(bv, offset);
|
UpdatableInset::scroll(bv, offset);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
ParagraphList * getParagraphs(int) const;
|
|
||||||
///
|
|
||||||
LyXText * getText(int) const;
|
LyXText * getText(int) const;
|
||||||
|
|
||||||
/// mark as erased for change tracking
|
/// mark as erased for change tracking
|
||||||
@ -140,8 +139,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void markNew(bool track_changes = false);
|
void markNew(bool track_changes = false);
|
||||||
|
|
||||||
///
|
|
||||||
void getDrawFont(LyXFont &) const;
|
|
||||||
/// append text onto the existing text
|
/// append text onto the existing text
|
||||||
void appendParagraphs(Buffer * bp, ParagraphList &);
|
void appendParagraphs(Buffer * bp, ParagraphList &);
|
||||||
|
|
||||||
@ -199,5 +196,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
mutable LyXText text_;
|
mutable LyXText text_;
|
||||||
|
///
|
||||||
|
mutable LyXFont font_;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -110,26 +110,31 @@ ParIterator & ParIterator::operator++()
|
|||||||
// Does the current inset contain more "cells" ?
|
// Does the current inset contain more "cells" ?
|
||||||
if (p.index) {
|
if (p.index) {
|
||||||
++(*p.index);
|
++(*p.index);
|
||||||
ParagraphList * plist = (*p.it)->inset->getParagraphs(*p.index);
|
if (LyXText * text = (*p.it)->inset->getText(*p.index)) {
|
||||||
if (plist && !plist->empty()) {
|
ParagraphList & plist = text->paragraphs();
|
||||||
pimpl_->positions.push_back(ParPosition(plist->begin(), *plist));
|
if (!plist.empty()) {
|
||||||
return *this;
|
pimpl_->positions.push_back(ParPosition(plist.begin(), plist));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++(*p.it);
|
++(*p.it);
|
||||||
} else
|
} else {
|
||||||
// The following line is needed because the value of
|
// The following line is needed because the value of
|
||||||
// p.it may be invalid if inset was added/removed to
|
// p.it may be invalid if inset was added/removed to
|
||||||
// the paragraph pointed by the iterator
|
// the paragraph pointed by the iterator
|
||||||
p.it.reset(p.pit->insetlist.begin());
|
p.it.reset(p.pit->insetlist.begin());
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find the next inset that contains paragraphs
|
// Try to find the next inset that contains paragraphs
|
||||||
InsetList::iterator end = p.pit->insetlist.end();
|
InsetList::iterator end = p.pit->insetlist.end();
|
||||||
for (; *p.it != end; ++(*p.it)) {
|
for (; *p.it != end; ++(*p.it)) {
|
||||||
ParagraphList * plist = (*p.it)->inset->getParagraphs(0);
|
if (LyXText * text = (*p.it)->inset->getText(0)) {
|
||||||
if (plist && !plist->empty()) {
|
ParagraphList & plist = text->paragraphs();
|
||||||
p.index.reset(0);
|
if (!plist.empty()) {
|
||||||
pimpl_->positions.push_back(ParPosition(plist->begin(), *plist));
|
p.index.reset(0);
|
||||||
return *this;
|
pimpl_->positions.push_back(ParPosition(plist.begin(), plist));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,26 +270,31 @@ ParConstIterator & ParConstIterator::operator++()
|
|||||||
// Does the current inset contain more "cells" ?
|
// Does the current inset contain more "cells" ?
|
||||||
if (p.index) {
|
if (p.index) {
|
||||||
++(*p.index);
|
++(*p.index);
|
||||||
ParagraphList * plist = (*p.it)->inset->getParagraphs(*p.index);
|
if (LyXText * text = (*p.it)->inset->getText(*p.index)) {
|
||||||
if (plist && !plist->empty()) {
|
ParagraphList & plist = text->paragraphs();
|
||||||
pimpl_->positions.push_back(ParPosition(plist->begin(), *plist));
|
if (!plist.empty()) {
|
||||||
return *this;
|
pimpl_->positions.push_back(ParPosition(plist.begin(), plist));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++(*p.it);
|
++(*p.it);
|
||||||
} else
|
} else {
|
||||||
// The following line is needed because the value of
|
// The following line is needed because the value of
|
||||||
// p.it may be invalid if inset was added/removed to
|
// p.it may be invalid if inset was added/removed to
|
||||||
// the paragraph pointed by the iterator
|
// the paragraph pointed by the iterator
|
||||||
p.it.reset(p.pit->insetlist.begin());
|
p.it.reset(p.pit->insetlist.begin());
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find the next inset that contains paragraphs
|
// Try to find the next inset that contains paragraphs
|
||||||
InsetList::iterator end = p.pit->insetlist.end();
|
InsetList::iterator end = p.pit->insetlist.end();
|
||||||
for (; *p.it != end; ++(*p.it)) {
|
for (; *p.it != end; ++(*p.it)) {
|
||||||
ParagraphList * plist = (*p.it)->inset->getParagraphs(0);
|
if (LyXText * text = (*p.it)->inset->getText(*p.index)) {
|
||||||
if (plist && !plist->empty()) {
|
ParagraphList & plist = text->paragraphs();
|
||||||
p.index.reset(0);
|
if (!plist.empty()) {
|
||||||
pimpl_->positions.push_back(ParPosition(plist->begin(), *plist));
|
p.index.reset(0);
|
||||||
return *this;
|
pimpl_->positions.push_back(ParPosition(plist.begin(), plist));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +426,9 @@ public:
|
|||||||
mutable int xo_;
|
mutable int xo_;
|
||||||
mutable int yo_;
|
mutable int yo_;
|
||||||
|
|
||||||
|
/// our 'outermost' Font
|
||||||
|
LyXFont font_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// rebreaks the given par
|
/// rebreaks the given par
|
||||||
|
@ -426,7 +426,7 @@ TeXOnePar(Buffer const & buf,
|
|||||||
return ++pit;
|
return ++pit;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //anon namespace
|
} // anon namespace
|
||||||
|
|
||||||
//
|
//
|
||||||
// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
|
// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
|
||||||
|
@ -564,11 +564,10 @@ ParagraphList::iterator outerPar(Buffer const & buf, InsetOld const * inset)
|
|||||||
ParIterator pit = const_cast<Buffer &>(buf).par_iterator_begin();
|
ParIterator pit = const_cast<Buffer &>(buf).par_iterator_begin();
|
||||||
ParIterator end = const_cast<Buffer &>(buf).par_iterator_end();
|
ParIterator end = const_cast<Buffer &>(buf).par_iterator_end();
|
||||||
for ( ; pit != end; ++pit) {
|
for ( ; pit != end; ++pit) {
|
||||||
|
LyXText * text;
|
||||||
ParagraphList * plist;
|
|
||||||
// the second '=' below is intentional
|
// the second '=' below is intentional
|
||||||
for (int i = 0; (plist = inset->getParagraphs(i)); ++i)
|
for (int i = 0; (text = inset->getText(i)); ++i)
|
||||||
if (plist == &pit.plist())
|
if (&text->paragraphs() == &pit.plist())
|
||||||
return pit.outerPar();
|
return pit.outerPar();
|
||||||
|
|
||||||
InsetList::iterator ii = pit->insetlist.begin();
|
InsetList::iterator ii = pit->insetlist.begin();
|
||||||
@ -588,10 +587,10 @@ Paragraph const & ownerPar(Buffer const & buf, InsetOld const * inset)
|
|||||||
ParConstIterator pit = buf.par_iterator_begin();
|
ParConstIterator pit = buf.par_iterator_begin();
|
||||||
ParConstIterator end = buf.par_iterator_end();
|
ParConstIterator end = buf.par_iterator_end();
|
||||||
for ( ; pit != end; ++pit) {
|
for ( ; pit != end; ++pit) {
|
||||||
ParagraphList * plist;
|
LyXText * text;
|
||||||
// the second '=' below is intentional
|
// the second '=' below is intentional
|
||||||
for (int i = 0; (plist = inset->getParagraphs(i)); ++i)
|
for (int i = 0; (text = inset->getText(i)); ++i)
|
||||||
if (plist == &pit.plist())
|
if (&text->paragraphs() == &pit.plist())
|
||||||
return *pit.pit();
|
return *pit.pit();
|
||||||
|
|
||||||
InsetList::const_iterator ii = pit->insetlist.begin();
|
InsetList::const_iterator ii = pit->insetlist.begin();
|
||||||
|
38
src/text.C
38
src/text.C
@ -314,25 +314,25 @@ int LyXText::leftMargin(ParagraphList::iterator pit, pos_type pos) const
|
|||||||
align = pit->params().align();
|
align = pit->params().align();
|
||||||
|
|
||||||
// set the correct parindent
|
// set the correct parindent
|
||||||
if (pos == 0) {
|
if (pos == 0
|
||||||
if ((layout->labeltype == LABEL_NO_LABEL
|
&& (layout->labeltype == LABEL_NO_LABEL
|
||||||
|| layout->labeltype == LABEL_TOP_ENVIRONMENT
|
|| layout->labeltype == LABEL_TOP_ENVIRONMENT
|
||||||
|| layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
|
|| layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
|
||||||
|| (layout->labeltype == LABEL_STATIC
|
|| (layout->labeltype == LABEL_STATIC
|
||||||
&& layout->latextype == LATEX_ENVIRONMENT
|
&& layout->latextype == LATEX_ENVIRONMENT
|
||||||
&& !isFirstInSequence(pit, paragraphs())))
|
&& !isFirstInSequence(pit, paragraphs())))
|
||||||
&& align == LYX_ALIGN_BLOCK
|
&& align == LYX_ALIGN_BLOCK
|
||||||
&& !pit->params().noindent()
|
&& !pit->params().noindent()
|
||||||
// in tabulars and ert paragraphs are never indented!
|
// in tabulars and ert paragraphs are never indented!
|
||||||
&& (!pit->inInset() || !pit->inInset()->owner() ||
|
&& (!pit->inInset()
|
||||||
(pit->inInset()->owner()->lyxCode() != InsetOld::TABULAR_CODE &&
|
|| !pit->inInset()->owner()
|
||||||
pit->inInset()->owner()->lyxCode() != InsetOld::ERT_CODE))
|
|| (pit->inInset()->owner()->lyxCode() != InsetOld::TABULAR_CODE
|
||||||
&& (pit->layout() != tclass.defaultLayout() ||
|
&& pit->inInset()->owner()->lyxCode() != InsetOld::ERT_CODE))
|
||||||
bv()->buffer()->params().paragraph_separation ==
|
&& (pit->layout() != tclass.defaultLayout()
|
||||||
BufferParams::PARSEP_INDENT)) {
|
|| bv()->buffer()->params().paragraph_separation ==
|
||||||
x += font_metrics::signedWidth(parindent,
|
BufferParams::PARSEP_INDENT))
|
||||||
tclass.defaultfont());
|
{
|
||||||
}
|
x += font_metrics::signedWidth(parindent, tclass.defaultfont());
|
||||||
}
|
}
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
|
@ -118,8 +118,8 @@ LyXFont LyXText::getFont(ParagraphList::iterator pit, pos_type pos) const
|
|||||||
// We specialize the 95% common case:
|
// We specialize the 95% common case:
|
||||||
if (!pit->getDepth()) {
|
if (!pit->getDepth()) {
|
||||||
LyXFont f = pit->getFontSettings(params, pos);
|
LyXFont f = pit->getFontSettings(params, pos);
|
||||||
if (pit->inInset())
|
if (in_inset_)
|
||||||
pit->inInset()->getDrawFont(f);
|
f.realize(font_);
|
||||||
if (layout->labeltype == LABEL_MANUAL && pos < body_pos)
|
if (layout->labeltype == LABEL_MANUAL && pos < body_pos)
|
||||||
return f.realize(layout->reslabelfont);
|
return f.realize(layout->reslabelfont);
|
||||||
else
|
else
|
||||||
@ -136,8 +136,8 @@ LyXFont LyXText::getFont(ParagraphList::iterator pit, pos_type pos) const
|
|||||||
LyXFont font = pit->getFontSettings(params, pos);
|
LyXFont font = pit->getFontSettings(params, pos);
|
||||||
font.realize(layoutfont);
|
font.realize(layoutfont);
|
||||||
|
|
||||||
if (pit->inInset())
|
if (in_inset_)
|
||||||
pit->inInset()->getDrawFont(font);
|
font.realize(font_);
|
||||||
|
|
||||||
// Realize with the fonts of lesser depth.
|
// Realize with the fonts of lesser depth.
|
||||||
//font.realize(outerFont(pit, paragraphs()));
|
//font.realize(outerFont(pit, paragraphs()));
|
||||||
|
Loading…
Reference in New Issue
Block a user