mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
a PosIterator-based ParIterator ctor and 1 user
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8051 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2c57d4b6ec
commit
18b2090a3f
@ -1,3 +1,8 @@
|
||||
2003-11-06 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* iterators.[Ch] (ParIterator): new PosIterator-based ctor
|
||||
* bufferview_funcs.C (put_selection_at): use the above
|
||||
|
||||
2003-11-05 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* text2.C (deleteEmptyParagraphMechanism): fix n-th crash
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
lyx::pos_type pos() const { return stack_.top().pos; }
|
||||
bool at_end() const;
|
||||
friend PosIterator ParIterator::asPosIterator(lyx::pos_type) const;
|
||||
friend ParIterator::ParIterator(PosIterator const &);
|
||||
|
||||
private:
|
||||
PosIterator() {};
|
||||
|
@ -428,9 +428,7 @@ void replaceSelection(LyXText * text)
|
||||
void put_selection_at(BufferView * bv, PosIterator const & cur,
|
||||
int length, bool backwards)
|
||||
{
|
||||
ParIterator par = bv->buffer()->par_iterator_begin();
|
||||
for (; par.pit() != cur.pit(); ++par)
|
||||
;
|
||||
ParIterator par(cur);
|
||||
|
||||
bv->getLyXText()->clearSelection();
|
||||
|
||||
|
@ -363,6 +363,31 @@ PosIterator ParIterator::asPosIterator(lyx::pos_type pos) const
|
||||
}
|
||||
|
||||
|
||||
ParIterator::ParIterator(PosIterator const & pos)
|
||||
: pimpl_(new Pimpl)
|
||||
{
|
||||
PosIterator copy = pos;
|
||||
int const size = copy.stack_.size();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
PosIteratorItem & it = copy.stack_.top();
|
||||
ParPosition pp(it.pit, *it.pl);
|
||||
if (i > 0) {
|
||||
InsetOld * inset = it.pit->getInset(it.pos);
|
||||
BOOST_ASSERT(inset);
|
||||
InsetList::iterator beg = it.pit->insetlist.begin();
|
||||
InsetList::iterator end = it.pit->insetlist.end();
|
||||
for (; beg != end && beg->inset != inset; ++beg);
|
||||
BOOST_ASSERT(beg != end);
|
||||
pp.it.reset(beg);
|
||||
pp.index.reset(it.index - 1);
|
||||
}
|
||||
pimpl_->positions.insert(pimpl_->positions.begin(), pp);
|
||||
copy.stack_.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParIterator::lockPath(BufferView * bv) const
|
||||
{
|
||||
bv->insetUnlock();
|
||||
|
@ -33,6 +33,8 @@ public:
|
||||
///
|
||||
ParIterator(ParIterator const &);
|
||||
///
|
||||
ParIterator(PosIterator const &);
|
||||
///
|
||||
void operator=(ParIterator const &);
|
||||
///
|
||||
ParIterator & operator++();
|
||||
@ -46,8 +48,7 @@ public:
|
||||
ParagraphList::iterator pit() const;
|
||||
///
|
||||
ParagraphList & plist() const;
|
||||
/// returns 'innermost' LyXText if in an inset or '0' instead of
|
||||
//bv->text
|
||||
/// returns 'innermost' LyXText
|
||||
LyXText * text(BufferView *) const;
|
||||
/// returns innermost inset
|
||||
InsetOld * inset() const;
|
||||
|
Loading…
Reference in New Issue
Block a user