mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
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:
parent
bddfd8ff66
commit
87a0c7598f
@ -370,15 +370,14 @@ LyXText * BufferView::text() const
|
|||||||
void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos)
|
void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos)
|
||||||
{
|
{
|
||||||
LCursor & cur = cursor();
|
LCursor & cur = cursor();
|
||||||
cur.reset();
|
cur.reset(buffer()->inset());
|
||||||
cur.push(buffer()->inset());
|
|
||||||
ParIterator::PosHolder const & positions = par.positions();
|
ParIterator::PosHolder const & positions = par.positions();
|
||||||
int const last = par.size() - 1;
|
int const last = par.size() - 1;
|
||||||
for (int i = 0; i < last; ++i)
|
for (int i = 0; i < last; ++i)
|
||||||
(*positions[i].it)->inset->edit(cur, true);
|
(*positions[i].it)->inset->edit(cur, true);
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
LyXText * text = par.text(*buffer());
|
LyXText & text = *par.text(*buffer());
|
||||||
text->setCursor(cur, text->parOffset(par.pit()), pos);
|
text.setCursor(cur, text.parOffset(par.pit()), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -442,14 +442,14 @@ void BufferView::Pimpl::scrollDocView(int value)
|
|||||||
int const first = top_y() + height;
|
int const first = top_y() + height;
|
||||||
int const last = top_y() + workarea().workHeight() - height;
|
int const last = top_y() + workarea().workHeight() - height;
|
||||||
|
|
||||||
bv_->cursor().reset();
|
bv_->cursor().reset(bv_->buffer()->inset());
|
||||||
LyXText * text = bv_->text();
|
LyXText * text = bv_->text();
|
||||||
CursorSlice & cur = bv_->cursor().front();
|
int y = text->cursorY(bv_->cursor().front());
|
||||||
int y = text->cursorY(cur);
|
|
||||||
if (y < first)
|
if (y < first)
|
||||||
text->setCursorFromCoordinates(bv_->cursor(), 0, first);
|
y = first;
|
||||||
else if (y > last)
|
if (y > last)
|
||||||
text->setCursorFromCoordinates(bv_->cursor(), 0, last);
|
y = last;
|
||||||
|
text->setCursorFromCoordinates(bv_->cursor(), 0, y);
|
||||||
|
|
||||||
owner_->updateLayoutChoice();
|
owner_->updateLayoutChoice();
|
||||||
}
|
}
|
||||||
@ -1028,7 +1028,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ACCEPT_ALL_CHANGES: {
|
case LFUN_ACCEPT_ALL_CHANGES: {
|
||||||
bv_->cursor().reset();
|
bv_->cursor().reset(bv_->buffer()->inset());
|
||||||
#warning FIXME changes
|
#warning FIXME changes
|
||||||
while (lyx::find::findNextChange(bv_))
|
while (lyx::find::findNextChange(bv_))
|
||||||
bv_->getLyXText()->acceptChange(bv_->cursor());
|
bv_->getLyXText()->acceptChange(bv_->cursor());
|
||||||
@ -1037,7 +1037,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_REJECT_ALL_CHANGES: {
|
case LFUN_REJECT_ALL_CHANGES: {
|
||||||
bv_->cursor().reset();
|
bv_->cursor().reset(bv_->buffer()->inset());
|
||||||
#warning FIXME changes
|
#warning FIXME changes
|
||||||
while (lyx::find::findNextChange(bv_))
|
while (lyx::find::findNextChange(bv_))
|
||||||
bv_->getLyXText()->rejectChange(bv_->cursor());
|
bv_->getLyXText()->rejectChange(bv_->cursor());
|
||||||
@ -1090,7 +1090,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BEGINNINGBUFSEL:
|
case LFUN_BEGINNINGBUFSEL:
|
||||||
bv_->cursor().reset();
|
bv_->cursor().reset(bv_->buffer()->inset());
|
||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
bv_->text()->cursorTop(cur);
|
bv_->text()->cursorTop(cur);
|
||||||
@ -1098,7 +1098,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_ENDBUFSEL:
|
case LFUN_ENDBUFSEL:
|
||||||
bv_->cursor().reset();
|
bv_->cursor().reset(bv_->buffer()->inset());
|
||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
bv_->text()->cursorBottom(cur);
|
bv_->text()->cursorBottom(cur);
|
||||||
|
@ -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>
|
2004-03-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* LColor.C (getFromLyXName): make sure that the color name is used
|
* LColor.C (getFromLyXName): make sure that the color name is used
|
||||||
|
@ -86,12 +86,12 @@ LCursor::LCursor(BufferView & bv)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void LCursor::reset()
|
void LCursor::reset(InsetBase & inset)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
push_back(CursorSlice());
|
push_back(CursorSlice(inset));
|
||||||
anchor_.clear();
|
anchor_.clear();
|
||||||
anchor_.push_back(CursorSlice());
|
anchor_.push_back(CursorSlice(inset));
|
||||||
cached_y_ = 0;
|
cached_y_ = 0;
|
||||||
clearTargetX();
|
clearTargetX();
|
||||||
selection_ = false;
|
selection_ = false;
|
||||||
|
@ -159,8 +159,9 @@ public:
|
|||||||
void info(std::ostream & os) const;
|
void info(std::ostream & os) const;
|
||||||
/// are we in math mode (2), text mode (1) or unsure (0)?
|
/// are we in math mode (2), text mode (1) or unsure (0)?
|
||||||
int currentMode();
|
int currentMode();
|
||||||
/// reset cursor
|
/// reset cursor bottom to the beginning of the given inset
|
||||||
void reset();
|
// (sort of 'chroot' environment...)
|
||||||
|
void reset(InsetBase &);
|
||||||
/// for spellchecking
|
/// for spellchecking
|
||||||
void replaceWord(std::string const & replacestring);
|
void replaceWord(std::string const & replacestring);
|
||||||
/// update our view
|
/// update our view
|
||||||
|
@ -80,6 +80,7 @@ Paragraph::Paragraph(Paragraph const & par)
|
|||||||
text_(par.text_), begin_of_body_(par.begin_of_body_),
|
text_(par.text_), begin_of_body_(par.begin_of_body_),
|
||||||
pimpl_(new Paragraph::Pimpl(*par.pimpl_, this))
|
pimpl_(new Paragraph::Pimpl(*par.pimpl_, this))
|
||||||
{
|
{
|
||||||
|
//lyxerr << "Paragraph::Paragraph(Paragraph const&)" << endl;
|
||||||
InsetList::iterator it = insetlist.begin();
|
InsetList::iterator it = insetlist.begin();
|
||||||
InsetList::iterator end = insetlist.end();
|
InsetList::iterator end = insetlist.end();
|
||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
@ -87,32 +88,30 @@ 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
|
// needed as we will destroy the pimpl_ before copying it
|
||||||
if (&par != this)
|
if (&par != this) {
|
||||||
return;
|
itemdepth = par.itemdepth;
|
||||||
|
|
||||||
lyxerr << "Paragraph::operator=()" << endl;
|
insetlist = par.insetlist;
|
||||||
|
InsetList::iterator it = insetlist.begin();
|
||||||
|
InsetList::iterator end = insetlist.end();
|
||||||
|
for (; it != end; ++it)
|
||||||
|
it->inset = it->inset->clone().release();
|
||||||
|
|
||||||
itemdepth = par.itemdepth;
|
rows = par.rows;
|
||||||
|
y = par.y;
|
||||||
|
height = par.height;
|
||||||
|
width = par.width;
|
||||||
|
layout_ = par.layout();
|
||||||
|
text_ = par.text_;
|
||||||
|
begin_of_body_ = par.begin_of_body_;
|
||||||
|
|
||||||
insetlist = par.insetlist;
|
delete pimpl_;
|
||||||
InsetList::iterator it = insetlist.begin();
|
pimpl_ = new Pimpl(*par.pimpl_, this);
|
||||||
InsetList::iterator end = insetlist.end();
|
}
|
||||||
for (; it != end; ++it)
|
return *this;
|
||||||
it->inset = it->inset->clone().release();
|
|
||||||
|
|
||||||
rows = par.rows;
|
|
||||||
y = par.y;
|
|
||||||
height = par.height;
|
|
||||||
width = par.width;
|
|
||||||
layout_ = par.layout();
|
|
||||||
text_ = par.text_;
|
|
||||||
begin_of_body_ = par.begin_of_body_;
|
|
||||||
|
|
||||||
delete pimpl_;
|
|
||||||
pimpl_ = new Pimpl(*par.pimpl_, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
///
|
///
|
||||||
Paragraph(Paragraph const &);
|
Paragraph(Paragraph const &);
|
||||||
///
|
///
|
||||||
void operator=(Paragraph const &);
|
Paragraph & operator=(Paragraph const &);
|
||||||
///
|
///
|
||||||
~Paragraph();
|
~Paragraph();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user