screen().hideCursor();
}
-
-LyXText * BufferView::getLyXText() const
+LyXText * BufferView::getLyXText()
{
LyXText * text = cursor().innerText();
BOOST_ASSERT(text);
}
+LyXText const * BufferView::getLyXText() const
+{
+ LyXText const * text = cursor().innerText();
+ BOOST_ASSERT(text);
+ return text;
+}
+
+
void BufferView::haveSelection(bool sel)
{
pimpl_->workarea().haveSelection(sel);
Change const getCurrentChange();
/// return the lyxtext we are using
- LyXText * getLyXText() const;
+ LyXText * getLyXText();
+
+ /// return the lyxtext we are using
+ LyXText const * getLyXText() const;
/// simple replacing. Use the font of the first selected character
void replaceSelectionWithString(std::string const & str);
t.redoParagraph(anchor_ref_);
int const h = t.getPar(anchor_ref_).height();
offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
- lyxerr << "scrolling: " << value << std::endl;
update();
if (!lyxrc.cursor_follows_scrollbar)
CoordCache backup;
std::swap(theCoords, backup);
+ theCoords.startUpdating();
//
ViewMetricsInfo vi = metrics();
if (forceupdate) {
// second drawing step
screen().redraw(*bv_, vi);
- } else
+ theCoords.doneUpdating();
+ } else {
+ // Abort updating of the coord cache - just restore the old one
std::swap(theCoords, backup);
+ }
} else
screen().greyOut();
void BufferView::Pimpl::center()
{
- CursorSlice const & bot = bv_->cursor().bottom();
+ CursorSlice & bot = bv_->cursor().bottom();
lyx::pit_type const pit = bot.pit();
bot.text()->redoParagraph(pit);
Paragraph const & par = bot.text()->paragraphs()[pit];
int y = y1;
for (lyx::pit_type pit = pit1; pit <= pit2; ++pit) {
y += text->getPar(pit).ascent();
- theCoords.pars_[text][pit] = Point(0, y);
+ theCoords.parPos()[text][pit] = Point(0, y);
y += text->getPar(pit).descent();
}
* lyxlex_pimpl.h: #include <fstream>.
+ * BufferView.[Ch] (getLyXText): add a const version.
+
+ * BufferView_pimpl.C: add debug aids.
+
+ * RowList_fwd.h:
+ * buffer.h:
+ * lyxrow.h:
+ * paragraph_funcs.h: add commentary explaining what the class does.
+
+
+ * coordcache.[Ch]: add lots of commentary.
+ (startUpdating, doneUpdating): debug aids.
+ (arrays, insets, parPos, getParPos): accessors to private data.
+
+ * cursor_slice.[Ch] (text): add a const version.
+ * dociterator.[Ch] (text, innerText): add const versions.
+
+ * lyxtext.h (breakParagraph): change the keep_layout arg to a
+ bool.
+
+ * paragraph.C (getRow, pos2ros): add asserts.
+
+ * paragraph.h: add commentary. Lots of.
+
+ * paragraph.[Ch] (metrucs, draw): removed.
+
+ * cursor.C:
+ * rowpainter.[Ch]: const-correct changes.
+
+ * text.C: various obvious clean-ups. Removal of ancient cruft.
+ Bug fixes, even.
+
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
* vc-backend.C (find_file): rewrite to use boost.filesystem
#include <vector>
+/**
+ * Each paragraph is broken up into a number of rows on the screen.
+ * This is a list of such on-screen rows, ordered from the top row
+ * downwards.
+ */
typedef std::vector<Row> RowList;
#endif
/** The buffer object.
- This is the buffer object. It contains all the informations about
- a document loaded into LyX. I am not sure if the class is complete or
- minimal, probably not.
- \author Lars Gullik Bjønnes
+ * This is the buffer object. It contains all the informations about
+ * a document loaded into LyX.
+ * The buffer object owns the LyXText (wrapped in an InsetText), which
+ * contains the individual paragraphs of the document.
+ *
+ *
+ * I am not sure if the class is complete or
+ * minimal, probably not.
+ * \author Lars Gullik Bjønnes
*/
class Buffer {
public:
Point getPos(DocIterator const & dit)
{
CursorSlice const & bot = dit.bottom();
- CoordCache::InnerParPosCache & cache = theCoords.pars_[bot.text()];
- CoordCache::InnerParPosCache::iterator it = cache.find(bot.pit());
+ CoordCache::InnerParPosCache const & cache = theCoords.getParPos().find(bot.text())->second;
+ CoordCache::InnerParPosCache::const_iterator it = cache.find(bot.pit());
if (it == cache.end()) {
//lyxerr << "cursor out of view" << std::endl;
return Point(-1,-1);
// this could be used elsewhere as well?
CurStatus status(BufferView const * bv, DocIterator const & dit)
{
- CoordCache::InnerParPosCache & cache = theCoords.pars_[dit.bottom().text()];
+ CoordCache::InnerParPosCache const & cache = theCoords.getParPos().find(dit.bottom().text())->second;
if (cache.find(dit.bottom().pit()) != cache.end())
return CUR_INSIDE;
}
-void lyxaborter(int x, int y)
-{
- lyxerr << "abort on x: " << x << " y: " << y << std::endl;
- BOOST_ASSERT(false);
-}
-
-
void CoordCache::clear()
{
+ BOOST_ASSERT(updating);
arrays_.clear();
insets_.clear();
pars_.clear();
}
+void CoordCache::startUpdating() {
+ BOOST_ASSERT(!updating);
+ updating = true;
+}
+
+
+void CoordCache::doneUpdating() {
+ BOOST_ASSERT(updating);
+ updating = false;
+}
Point CoordCache::get(LyXText const * text, lyx::pit_type pit)
{
#include <map>
-
-// All positions cached in this cache are only valid between subsequent
-// updated. (x,y) == (0,0) is the upper left screen corner, x increases
-// to the right, y increases downwords.
-
void lyxbreaker(void const * data, const char * hint, int size);
-void lyxaborter(int x, int y);
class Point {
public:
cache_type data_;
};
-
+/**
+ * A global cache that allows us to come from a paragraph in a document
+ * to a position point on the screen.
+ * All points cached in this cache are only valid between subsequent
+ * updated. (x,y) == (0,0) is the upper left screen corner, x increases
+ * to the right, y increases downwords.
+ * The cache is built in BufferView::Pimpl::metrics which is called
+ * from BufferView::Pimpl::update. The individual points are added
+ * while we paint them. See for instance paintPar in RowPainter.C.
+ */
class CoordCache {
public:
+ CoordCache() : updating(false) { }
+ /// In order to find bugs, we record when we start updating the cache
+ void startUpdating();
+ /// When we are done, we record that to help find bugs
+ void doneUpdating();
+
void clear();
Point get(LyXText const *, lyx::pit_type);
+ /// A map from paragraph index number to screen point
+ typedef std::map<lyx::pit_type, Point> InnerParPosCache;
+ /// A map from a LyXText to the map of paragraphs to screen points
+ typedef std::map<LyXText const *, InnerParPosCache> ParPosCache;
+
+ /// A map from MathArray to position on the screen
+ CoordCacheBase<MathArray> & arrays() { BOOST_ASSERT(updating); return arrays_; }
+ CoordCacheBase<MathArray> const & getArrays() const { return arrays_; }
+ /// A map from insets to positions on the screen
+ CoordCacheBase<InsetBase> & insets() { BOOST_ASSERT(updating); return insets_; }
+ CoordCacheBase<InsetBase> const & getInsets() const { return insets_; }
+ /// A map from (LyXText, paragraph) pair to screen positions
+ ParPosCache & parPos() { BOOST_ASSERT(updating); return pars_; }
+ ParPosCache const & getParPos() const { return pars_; }
+private:
CoordCacheBase<MathArray> arrays_;
// all insets
CoordCacheBase<InsetBase> insets_;
// paragraph grouped by owning text
- typedef std::map<lyx::pit_type, Point> InnerParPosCache;
- typedef std::map<LyXText const *, InnerParPosCache> ParPosCache;
ParPosCache pars_;
+
+ /**
+ * Debugging flag only: Set to true while the cache is being built.
+ * No changes to the structure are allowed unless we are updating.
+ */
+ bool updating;
};
extern CoordCache theCoords;
if (operator[](s).text())
break;
CursorSlice const & sl = operator[](s);
- LyXText & text = *sl.text();
+ LyXText const & text = *sl.text();
LyXFont font = text.getPar(sl.pit()).getFont(
bv().buffer()->params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
return font.language()->encoding();
if (operator[](s).text())
break;
CursorSlice const & sl = operator[](s);
- LyXText & text = *sl.text();
+ LyXText const & text = *sl.text();
LyXFont font = text.getPar(sl.pit()).getFont(
bv().buffer()->params(),
sl.pos(),
}
-LyXText * CursorSlice::text() const
+LyXText * CursorSlice::text()
+{
+ BOOST_ASSERT(inset_);
+ return inset_->getText(idx_);
+}
+
+LyXText const * CursorSlice::text() const
{
BOOST_ASSERT(inset_);
return inset_->getText(idx_);
/// see comment for the member
bool & boundary() { return boundary_; }
///
- LyXText * text() const;
+ LyXText * text();
+ ///
+ LyXText const * text() const;
///
UpdatableInset * asUpdatableInset() const;
///
}
-LyXText * DocIterator::text() const
+LyXText * DocIterator::text()
+{
+ BOOST_ASSERT(!empty());
+ return top().text();
+}
+
+LyXText const * DocIterator::text() const
{
BOOST_ASSERT(!empty());
return top().text();
Row & DocIterator::textRow()
{
+ BOOST_ASSERT(!paragraph().rows().empty());
return paragraph().getRow(pos());
}
Row const & DocIterator::textRow() const
{
+ BOOST_ASSERT(!paragraph().rows().empty());
return paragraph().getRow(pos());
}
}
-LyXText * DocIterator::innerText() const
+LyXText * DocIterator::innerText()
+{
+ BOOST_ASSERT(!empty());
+ // go up until first non-0 text is hit
+ // (innermost text is 0 in mathed)
+ for (int i = size() - 1; i >= 0; --i)
+ if (operator[](i).text())
+ return operator[](i).text();
+ return 0;
+}
+
+LyXText const * DocIterator::innerText() const
{
BOOST_ASSERT(!empty());
// go up until first non-0 text is hit
/// the row in the paragraph we're in
Row const & textRow() const;
///
- LyXText * text() const;
+ LyXText * text();
+ ///
+ LyXText const * text() const;
///
InsetBase * innerInsetOfType(int code) const;
///
- LyXText * innerText() const;
+ LyXText * innerText();
+ ///
+ LyXText const * innerText() const;
//
// elementary moving
+2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
+
+ * inset.C:
+ * insetbase.C:
+ * insettabular.C:
+ * updatableinset.C: Use new cursor accessors.
+
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
* insetinclude.C (loadIfNeeded): rewrite to use boost.filesystem
void InsetOld::setPosCache(PainterInfo const &, int x, int y) const
{
//lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
- theCoords.insets_.add(this, x, y);
+ theCoords.insets().add(this, x, y);
}
int InsetBase::xo() const
{
- return theCoords.insets_.x(this);
+ return theCoords.getInsets().x(this);
}
int InsetBase::yo() const
{
- return theCoords.insets_.y(this);
+ return theCoords.getInsets().y(this);
}
// << " x1: " << xo() << " x2: " << xo() + width()
// << " y1: " << yo() - ascent() << " y2: " << yo() + descent()
// << std::endl;
- return theCoords.insets_.has(this)
+ return theCoords.getInsets().has(this)
&& x >= xo()
&& x <= xo() + width()
&& y >= yo() - ascent()
{
int xx = 0;
int yy = 0;
- Point o = theCoords.insets_.xy(&inset);
+ Point o = theCoords.getInsets().xy(&inset);
int const xo = o.x_;
int const yo = o.y_;
idx_type idx_min = 0;
int dist_min = std::numeric_limits<int>::max();
for (idx_type i = 0; i < nargs(); ++i) {
- if (theCoords.insets_.has(tabular.getCellInset(i).get())) {
+ if (theCoords.getInsets().has(tabular.getCellInset(i).get())) {
int d = dist(*tabular.getCellInset(i), x, y);
if (d < dist_min) {
dist_min = d;
}
int const workW = bv.workWidth();
- int xo_ = theCoords.insets_.x(this);
+ int xo_ = theCoords.getInsets().x(this);
int const tmp_xo_ = xo_ - scx;
if (tmp_xo_ > 0 && tmp_xo_ + width() < workW)
void UpdatableInset::scroll(BufferView & bv, int offset) const
{
- int const xo_ = theCoords.insets_.x(this);
+ int const xo_ = theCoords.getInsets().x(this);
if (offset > 0) {
if (!scx && xo_ >= 20)
return;
#include "support/types.h"
-///
+/**
+ * An on-screen row of text. A paragraph is broken into a
+ * RowList for display. Each Row contains position pointers
+ * into the first and last character positions of that row.
+ */
class Row {
public:
///
bool toggleall);
/// what you expect when pressing <enter> at cursor position
- void breakParagraph(LCursor & cur, char keep_layout = 0);
+ void breakParagraph(LCursor & cur, bool keep_layout = false);
/// set layout over selection
pit_type setLayout(pit_type start, pit_type end,
FuncStatus & status) const;
/// access to out BufferView. This should go...
- BufferView * bv();
+// BufferView * bv();
/// access to out BufferView. This should go...
BufferView * bv() const;
+2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
+
+ * math_data.C:
+ * math_diminset.C:
+ * math_nestinset.C: Use new cursor accessors.
+
2005-01-27 Lars Gullik Bjonnes <larsbj@gullik.net>
* math_parser.C,math_sizeinset.C: use convert<> instead of
void MathArray::setXY(int x, int y) const
{
//lyxerr << "setting position cache for MathArray " << this << std::endl;
- theCoords.arrays_.add(this, x, y);
+ theCoords.arrays().add(this, x, y);
}
int MathArray::xo() const
{
- return theCoords.arrays_.x(this);
+ return theCoords.getArrays().x(this);
}
int MathArray::yo() const
{
- return theCoords.arrays_.y(this);
+ return theCoords.getArrays().y(this);
}
void MathDimInset::setPosCache(PainterInfo const &, int x, int y) const
{
//lyxerr << "MathDimInset: cache to " << x << " " << y << std::endl;
- theCoords.insets_.add(this, x, y);
+ theCoords.insets().add(this, x, y);
}
// absolute again when actually drawing the cursor. What a mess.
BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
MathArray const & ar = sl.cell();
- if (!theCoords.arrays_.has(&ar)) {
- // this can (semi-)legally happen if we jsut created this cell
+ if (!theCoords.getArrays().has(&ar)) {
+ // this can (semi-)legally happen if we just created this cell
// and it never has been drawn before. So don't ASSERT.
//lyxerr << "no cached data for array " << &ar << endl;
x = 0;
y = 0;
return;
}
- Point const pt = theCoords.arrays_.xy(&ar);
- if (!theCoords.insets_.has(this)) {
+ Point const pt = theCoords.getArrays().xy(&ar);
+ if (!theCoords.getInsets().has(this)) {
// same as above
//lyxerr << "no cached data for inset " << this << endl;
x = 0;
y = 0;
return;
}
- Point const pt2 = theCoords.insets_.xy(this);
+ Point const pt2 = theCoords.getInsets().xy(this);
//lyxerr << "retrieving position cache for MathArray "
// << pt.x_ << ' ' << pt.y_ << std::endl;
x = pt.x_ - pt2.x_ + ar.pos2x(sl.pos());
Row & Paragraph::getRow(pos_type pos)
{
+ BOOST_ASSERT(!rows().empty());
+
RowList::iterator rit = rows_.end();
RowList::iterator const begin = rows_.begin();
Row const & Paragraph::getRow(pos_type pos) const
{
+ BOOST_ASSERT(!rows().empty());
+
RowList::const_iterator rit = rows_.end();
RowList::const_iterator const begin = rows_.begin();
size_t Paragraph::pos2row(pos_type pos) const
{
+ BOOST_ASSERT(!rows().empty());
+
RowList::const_iterator rit = rows_.end();
RowList::const_iterator const begin = rows_.begin();
}
}
-//void Paragraph::metrics(MetricsInfo & mi, Dimension & dim, LyXText & text)
-//{
-//}
-//
-//
-//void draw(PainterInfo & pi, int x, int y, LyXText & text) const
-//{
-//}
lyx::depth_type depth) const;
/// Can we drop the standard paragraph wrapper?
- bool Paragraph::emptyTag() const;
+ bool emptyTag() const;
/// Get the id of the paragraph, usefull for docbook and linuxdoc
std::string getID(Buffer const & buf,
BOOST_ASSERT(pos < int(text_.size()));
return text_[pos];
}
- ///
+ /// Get the char, but mirror all bracket characters if it is right-to-left
value_type getUChar(BufferParams const &, lyx::pos_type pos) const;
/// The position must already exist.
void setChar(lyx::pos_type pos, value_type c);
InsetBase * getInset(lyx::pos_type pos);
///
InsetBase const * getInset(lyx::pos_type pos) const;
+ ///
+ InsetList insetlist;
+
///
bool isHfill(lyx::pos_type pos) const;
/// returns -1 if inset not found
int getPositionOfInset(InsetBase const * inset) const;
- ///
+ /// Returns the number of line breaks and white-space stripped at the start
int stripLeadingSpaces();
/// return true if we allow multiple spaces
/// return true if we allow this par to stay empty
bool allowEmpty() const;
- ////
+ ///
unsigned char transformChar(unsigned char c, lyx::pos_type pos) const;
///
ParagraphParameters & params();
///
size_t pos2row(lyx::pos_type pos) const;
- ///
- InsetList insetlist;
-
/// total height of paragraph
unsigned int height() const { return dim_.height(); }
/// total width of paragraph, may differ from workwidth
unsigned int width() const { return dim_.width(); }
unsigned int ascent() const { return dim_.ascent(); }
unsigned int descent() const { return dim_.descent(); }
- ///
+ /// LyXText updates the rows using this access point
RowList & rows() { return rows_; }
- ///
+ /// The painter and others use this
RowList const & rows() const { return rows_; }
- // compute paragraph metrics
- void metrics(MetricsInfo & mi, Dimension & dim, LyXText & text);
- // draw paragraph
- void draw(PainterInfo & pi, int x, int y, LyXText & text) const;
- /// dump some information
- void dump() const;
+ /// LyXText::redoParagraph updates this
+ Dimension & dim() { return dim_; }
+ /// dump some information to lyxerr
+ void dump() const;
+private:
/// cached dimensions of paragraph
Dimension dim_;
-private:
///
mutable RowList rows_;
///
LyXLayout_ptr layout_;
- /// keeping this here instead of in the pimpl makes LyX >10% faster
- // for average tasks as buffer loading/switching etc.
+ /**
+ * Keeping this here instead of in the pimpl makes LyX >10% faster
+ * for average tasks as buffer loading/switching etc.
+ */
TextContainer text_;
/// end of label
lyx::pos_type begin_of_body_;
friend class Paragraph::Pimpl;
///
Pimpl * pimpl_;
-
};
class Paragraph;
class ParagraphList;
-
-///
+/**
+ * This breaks a paragraph at the specified position.
+ * The new paragraph will:
+ * get the default layout, when flag == 0
+ * will inherit the existing one, except for depth, when flag == 1
+ * will inherit the existing one, including depth, when flag == 2
+ * Be aware that the old or new paragraph does not contain any rows
+ * after this.
+ */
void breakParagraph(BufferParams const & bparams,
ParagraphList & paragraphs,
lyx::pit_type par,
public:
/// initialise and run painter
RowPainter(PainterInfo & pi, LyXText const & text,
- pit_type pit, Row & row, int x, int y);
+ pit_type pit, Row const & row, int x, int y);
// paint various parts
void paintAppendix();
ParagraphList & pars_;
/// The row to paint
- Row & row_;
+ Row const & row_;
/// Row's paragraph
pit_type const pit_;
RowPainter::RowPainter(PainterInfo & pi,
- LyXText const & text, pit_type pit, Row & row, int x, int y)
+ LyXText const & text, pit_type pit, Row const & row, int x, int y)
: bv_(*pi.base.bv), pain_(pi.pain), text_(text), pars_(text.paragraphs()),
row_(row), pit_(pit), par_(text.paragraphs()[pit]),
xo_(x), yo_(y), width_(text_.width())
PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
pi.base.font = getFont(pos);
pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
- theCoords.insets_.add(inset, int(x_), yo_);
+ theCoords.insets().add(inset, int(x_), yo_);
inset->drawSelection(pi, int(x_), yo_);
inset->draw(pi, int(x_), yo_);
x_ += inset->width();
Paragraph & par = text.paragraphs()[pit];
- RowList::iterator const rb = par.rows().begin();
- RowList::iterator const re = par.rows().end();
- theCoords.pars_[&text][pit] = Point(x, y);
+ RowList::const_iterator const rb = par.rows().begin();
+ RowList::const_iterator const re = par.rows().end();
+ theCoords.parPos()[&text][pit] = Point(x, y);
y -= rb->ascent();
- for (RowList::iterator rit = rb; rit != re; ++rit) {
+ for (RowList::const_iterator rit = rb; rit != re; ++rit) {
y += rit->ascent();
bool const inside = (y + rit->descent() >= 0
&& y - rit->ascent() < ww);
}
// and grey out above (should not happen later)
- lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
+// lyxerr << "par ascent: " << text->getPar(vi.p1).ascent() << endl;
if (vi.y1 > 0)
pain.fillRectangle(0, 0, bv.workWidth(), vi.y1, LColor::bottomarea);
// and possibly grey out below
- lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
+// lyxerr << "par descent: " << text->getPar(vi.p1).ascent() << endl;
if (vi.y2 < bv.workHeight())
pain.fillRectangle(0, vi.y2, bv.workWidth(), bv.workHeight() - vi.y2, LColor::bottomarea);
}
} // namespace anon
-BufferView * LyXText::bv()
-{
- BOOST_ASSERT(bv_owner != 0);
- return bv_owner;
-}
-
BufferView * LyXText::bv() const
{
}
-void LyXText::breakParagraph(LCursor & cur, char keep_layout)
+void LyXText::breakParagraph(LCursor & cur, bool keep_layout)
{
BOOST_ASSERT(this == cur.text());
// allow only if at start or end, or all previous is new text
if (cur.pos() != cur.lastpos() && cpar.isLineSeparator(cur.pos()))
cpar.erase(cur.pos());
- // break the paragraph
+ // How should the layout for the new paragraph be?
+ int preserve_layout = 0;
if (keep_layout)
- keep_layout = 2;
+ preserve_layout = 2;
else
- keep_layout = layout->isEnvironment();
+ preserve_layout = layout->isEnvironment();
+
+ // We need to remember this before we break the paragraph, because
+ // that invalidates the layout variable
+ bool sensitive = layout->labeltype == LABEL_SENSITIVE;
- // we need to set this before we insert the paragraph. IMO the
- // breakParagraph call should return a bool if it inserts the
- // paragraph before or behind and we should react on that one
- // but we can fix this in 1.3.0 (Jug 20020509)
+ // we need to set this before we insert the paragraph.
bool const isempty = cpar.allowEmpty() && cpar.empty();
+
::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
- cur.pos(), keep_layout);
+ cur.pos(), preserve_layout);
+
+ // After this, neither paragraph contains any rows!
cpit = cur.pit();
pit_type next_par = cpit + 1;
// well this is the caption hack since one caption is really enough
- if (layout->labeltype == LABEL_SENSITIVE) {
+ if (sensitive) {
if (cur.pos() == 0)
// set to standard-layout
pars_[cpit].applyLayout(tclass.defaultLayout());
pars_[next_par].applyLayout(tclass.defaultLayout());
}
- // if the cursor is at the beginning of a row without prior newline,
- // move one row up!
- // This touches only the screen-update. Otherwise we would may have
- // an empty row on the screen
- if (cur.pos() != 0 && cur.textRow().pos() == cur.pos()
- && !pars_[cpit].isNewline(cur.pos() - 1))
- {
- cursorLeft(cur);
- }
-
while (!pars_[next_par].empty() && pars_[next_par].isNewline(0))
pars_[next_par].erase(0);
cur.message(_("You cannot insert a space at the "
"beginning of a paragraph. Please read the Tutorial."));
sent_space_message = true;
- return;
}
+ return;
}
BOOST_ASSERT(cur.pos() > 0);
if (par.isLineSeparator(cur.pos() - 1)
dim.asc += par.rows()[0].ascent();
dim.des -= par.rows()[0].ascent();
- par.dim_ = dim;
+ par.dim() = dim;
//lyxerr << "redoParagraph: " << par.rows().size() << " rows\n";
}
InsetBase * inset = iit->inset;
#if 1
lyxerr << "examining inset " << inset << endl;
- if (theCoords.insets_.has(inset))
+ if (theCoords.getInsets().has(inset))
lyxerr
<< " xo: " << inset->xo() << "..."
<< inset->xo() + inset->width()
pit_type LyXText::getPitNearY(int y) const
{
BOOST_ASSERT(!paragraphs().empty());
- BOOST_ASSERT(theCoords.pars_.find(this) != theCoords.pars_.end());
- CoordCache::InnerParPosCache const & cc = theCoords.pars_[this];
+ BOOST_ASSERT(theCoords.getParPos().find(this) != theCoords.getParPos().end());
+ CoordCache::InnerParPosCache const & cc = theCoords.getParPos().find(this)->second;
lyxerr << "LyXText::getPitNearY: y: " << y << " cache size: "
<< cc.size() << endl;
void LyXText::cursorDown(LCursor & cur)
{
-
-
Paragraph const & par = cur.paragraph();
int const row = par.pos2row(cur.pos());
int const x = cur.targetX();
void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
{
lyxerr[Debug::ACTION] << "LyXText::dispatch: cmd: " << cmd << endl;
- //lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
+ lyxerr << "*** LyXText::dispatch: cmd: " << cmd << endl;
BOOST_ASSERT(cur.text() == this);
BufferView * bv = &cur.bv();