andre's "brown paper bag" patch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8506 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2004-03-19 16:36:52 +00:00
parent bddfd8ff66
commit 87a0c7598f
7 changed files with 51 additions and 41 deletions

View File

@ -370,15 +370,14 @@ LyXText * BufferView::text() const
void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos)
{
LCursor & cur = cursor();
cur.reset();
cur.push(buffer()->inset());
cur.reset(buffer()->inset());
ParIterator::PosHolder const & positions = par.positions();
int const last = par.size() - 1;
for (int i = 0; i < last; ++i)
(*positions[i].it)->inset->edit(cur, true);
cur.resetAnchor();
LyXText * text = par.text(*buffer());
text->setCursor(cur, text->parOffset(par.pit()), pos);
LyXText & text = *par.text(*buffer());
text.setCursor(cur, text.parOffset(par.pit()), pos);
}

View File

@ -442,14 +442,14 @@ void BufferView::Pimpl::scrollDocView(int value)
int const first = top_y() + height;
int const last = top_y() + workarea().workHeight() - height;
bv_->cursor().reset();
bv_->cursor().reset(bv_->buffer()->inset());
LyXText * text = bv_->text();
CursorSlice & cur = bv_->cursor().front();
int y = text->cursorY(cur);
int y = text->cursorY(bv_->cursor().front());
if (y < first)
text->setCursorFromCoordinates(bv_->cursor(), 0, first);
else if (y > last)
text->setCursorFromCoordinates(bv_->cursor(), 0, last);
y = first;
if (y > last)
y = last;
text->setCursorFromCoordinates(bv_->cursor(), 0, y);
owner_->updateLayoutChoice();
}
@ -1028,7 +1028,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
break;
case LFUN_ACCEPT_ALL_CHANGES: {
bv_->cursor().reset();
bv_->cursor().reset(bv_->buffer()->inset());
#warning FIXME changes
while (lyx::find::findNextChange(bv_))
bv_->getLyXText()->acceptChange(bv_->cursor());
@ -1037,7 +1037,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
}
case LFUN_REJECT_ALL_CHANGES: {
bv_->cursor().reset();
bv_->cursor().reset(bv_->buffer()->inset());
#warning FIXME changes
while (lyx::find::findNextChange(bv_))
bv_->getLyXText()->rejectChange(bv_->cursor());
@ -1090,7 +1090,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
break;
case LFUN_BEGINNINGBUFSEL:
bv_->cursor().reset();
bv_->cursor().reset(bv_->buffer()->inset());
if (!cur.selection())
cur.resetAnchor();
bv_->text()->cursorTop(cur);
@ -1098,7 +1098,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
break;
case LFUN_ENDBUFSEL:
bv_->cursor().reset();
bv_->cursor().reset(bv_->buffer()->inset());
if (!cur.selection())
cur.resetAnchor();
bv_->text()->cursorBottom(cur);

View File

@ -1,3 +1,14 @@
2004-03-19 André Pönitz <poenitz@gmx.net>
        * cursor.[Ch] (reset): take main text inset as argument
        * BufferView: adjust
        * BufferView_pimpl.C: adjust
        * paragraph.[Ch]: fix completely broken operator=()
2004-03-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* LColor.C (getFromLyXName): make sure that the color name is used

View File

@ -86,12 +86,12 @@ LCursor::LCursor(BufferView & bv)
{}
void LCursor::reset()
void LCursor::reset(InsetBase & inset)
{
clear();
push_back(CursorSlice());
push_back(CursorSlice(inset));
anchor_.clear();
anchor_.push_back(CursorSlice());
anchor_.push_back(CursorSlice(inset));
cached_y_ = 0;
clearTargetX();
selection_ = false;

View File

@ -159,8 +159,9 @@ public:
void info(std::ostream & os) const;
/// are we in math mode (2), text mode (1) or unsure (0)?
int currentMode();
/// reset cursor
void reset();
/// reset cursor bottom to the beginning of the given inset
// (sort of 'chroot' environment...)
void reset(InsetBase &);
/// for spellchecking
void replaceWord(std::string const & replacestring);
/// update our view

View File

@ -80,6 +80,7 @@ Paragraph::Paragraph(Paragraph const & par)
text_(par.text_), begin_of_body_(par.begin_of_body_),
pimpl_(new Paragraph::Pimpl(*par.pimpl_, this))
{
//lyxerr << "Paragraph::Paragraph(Paragraph const&)" << endl;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it)
@ -87,14 +88,10 @@ Paragraph::Paragraph(Paragraph const & par)
}
void Paragraph::operator=(Paragraph const & par)
Paragraph & Paragraph::operator=(Paragraph const & par)
{
// needed as we will destroy the pimpl_ before copying it
if (&par != this)
return;
lyxerr << "Paragraph::operator=()" << endl;
if (&par != this) {
itemdepth = par.itemdepth;
insetlist = par.insetlist;
@ -114,6 +111,8 @@ void Paragraph::operator=(Paragraph const & par)
delete pimpl_;
pimpl_ = new Pimpl(*par.pimpl_, this);
}
return *this;
}
Paragraph::~Paragraph()

View File

@ -65,7 +65,7 @@ public:
///
Paragraph(Paragraph const &);
///
void operator=(Paragraph const &);
Paragraph & operator=(Paragraph const &);
///
~Paragraph();