mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 07:42:02 +00:00
part of Lars' parlist-14-a.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6872 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
be647db7c0
commit
e83de85ff7
@ -1,3 +1,9 @@
|
||||
|
||||
2003-04-28 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* tabular.[Ch]: part of Lars' Paragraph * -> ParagraphList::iterator
|
||||
Changes
|
||||
|
||||
2003-04-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* messages.C: remove one more localedir class variable.
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
2003-04-28 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insettext.[Ch]: part of Lars' Paragraph * -> ParagraphList::iterator
|
||||
Changes
|
||||
|
||||
2003-04-25 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetenv.C: derive from InsetText instead of InsetCollapsable
|
||||
|
@ -162,7 +162,7 @@ InsetText & InsetText::operator=(InsetText const & it)
|
||||
void InsetText::init(InsetText const * ins, bool same_id)
|
||||
{
|
||||
if (ins) {
|
||||
setParagraphData(&*(ins->paragraphs.begin()), same_id);
|
||||
setParagraphData(ins->paragraphs, same_id);
|
||||
autoBreakRows = ins->autoBreakRows;
|
||||
drawFrame_ = ins->drawFrame_;
|
||||
frame_color = ins->frame_color;
|
||||
@ -545,9 +545,15 @@ void InsetText::setUpdateStatus(BufferView * bv, int what) const
|
||||
|
||||
void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
|
||||
{
|
||||
#if 0
|
||||
if (!autoBreakRows &&
|
||||
boost::next(paragraphs.begin()) != paragraphs.end())
|
||||
collapseParagraphs(bv);
|
||||
#else
|
||||
if (!autoBreakRows && paragraphs.size() > 1)
|
||||
collapseParagraphs(bv);
|
||||
#endif
|
||||
|
||||
bool clear = false;
|
||||
if (!lt) {
|
||||
lt = getLyXText(bv);
|
||||
@ -1796,13 +1802,18 @@ Inset::RESULT
|
||||
InsetText::moveRightIntern(BufferView * bv, bool front,
|
||||
bool activate_inset, bool selecting)
|
||||
{
|
||||
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
|
||||
LyXText * text = getLyXText(bv);
|
||||
|
||||
ParagraphList::iterator c_par = cpar(bv);
|
||||
|
||||
if (boost::next(c_par) == paragraphs.end() &&
|
||||
(cpos(bv) >= c_par->size()))
|
||||
return FINISHED_RIGHT;
|
||||
if (activate_inset && checkAndActivateInset(bv, front))
|
||||
return DISPATCHED;
|
||||
getLyXText(bv)->cursorRight(bv);
|
||||
text->cursorRight(bv);
|
||||
if (!selecting)
|
||||
getLyXText(bv)->clearSelection();
|
||||
text->clearSelection();
|
||||
return DISPATCHED_NOUPDATE;
|
||||
}
|
||||
|
||||
@ -1811,11 +1822,13 @@ Inset::RESULT
|
||||
InsetText::moveLeftIntern(BufferView * bv, bool front,
|
||||
bool activate_inset, bool selecting)
|
||||
{
|
||||
if (!cpar(bv)->previous() && (cpos(bv) <= 0))
|
||||
LyXText * text = getLyXText(bv);
|
||||
|
||||
if (cpar(bv) == paragraphs.begin() && (cpos(bv) <= 0))
|
||||
return FINISHED;
|
||||
getLyXText(bv)->cursorLeft(bv);
|
||||
text->cursorLeft(bv);
|
||||
if (!selecting)
|
||||
getLyXText(bv)->clearSelection();
|
||||
text->clearSelection();
|
||||
if (activate_inset && checkAndActivateInset(bv, front))
|
||||
return DISPATCHED;
|
||||
return DISPATCHED_NOUPDATE;
|
||||
@ -1938,7 +1951,7 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||
clear = true;
|
||||
}
|
||||
if (lt->selection.set()) {
|
||||
setUndo(bv, Undo::EDIT, &*lt->cursor.par(), lt->cursor.par()->next());
|
||||
setUndo(bv, Undo::EDIT, &*lt->cursor.par(), &*boost::next(lt->cursor.par()));
|
||||
}
|
||||
if (selectall)
|
||||
selectAll(bv);
|
||||
@ -2024,22 +2037,20 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::setParagraphData(Paragraph * p, bool same_id)
|
||||
void InsetText::setParagraphData(ParagraphList const & plist, bool same_id)
|
||||
{
|
||||
// we have to unlock any locked inset otherwise we're in troubles
|
||||
the_locking_inset = 0;
|
||||
|
||||
paragraphs.clear();
|
||||
paragraphs.set(new Paragraph(*p, same_id));
|
||||
paragraphs.begin()->setInsetOwner(this);
|
||||
Paragraph * np = &*(paragraphs.begin());
|
||||
while (p->next()) {
|
||||
p = p->next();
|
||||
np->next(new Paragraph(*p, same_id));
|
||||
np->next()->previous(np);
|
||||
np = np->next();
|
||||
np->setInsetOwner(this);
|
||||
ParagraphList::iterator pit = plist.begin();
|
||||
ParagraphList::iterator pend = plist.end();
|
||||
for (; pit != pend; ++pit) {
|
||||
Paragraph * new_par = new Paragraph(*pit, same_id);
|
||||
new_par->setInsetOwner(this);
|
||||
paragraphs.push_back(new_par);
|
||||
}
|
||||
|
||||
reinitLyXText();
|
||||
need_update = INIT;
|
||||
}
|
||||
@ -2150,9 +2161,9 @@ pos_type InsetText::cpos(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
Paragraph * InsetText::cpar(BufferView * bv) const
|
||||
ParagraphList::iterator InsetText::cpar(BufferView * bv) const
|
||||
{
|
||||
return &*getLyXText(bv)->cursor.par();
|
||||
return getLyXText(bv)->cursor.par();
|
||||
}
|
||||
|
||||
|
||||
@ -2703,9 +2714,13 @@ void InsetText::getDrawFont(LyXFont & font) const
|
||||
|
||||
|
||||
void InsetText::appendParagraphs(Buffer * buffer,
|
||||
Paragraph * newpar)
|
||||
ParagraphList & plist)
|
||||
{
|
||||
#warning FIXME Check if Changes stuff needs changing here. (Lgb)
|
||||
// And it probably does. You have to take a look at this John. (Lgb)
|
||||
#warning John, have a look here. (Lgb)
|
||||
BufferParams const & bparams = buffer->params;
|
||||
#if 0
|
||||
Paragraph * buf;
|
||||
Paragraph * tmpbuf = newpar;
|
||||
Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
|
||||
@ -2720,6 +2735,7 @@ void InsetText::appendParagraphs(Buffer * buffer,
|
||||
if (bparams.tracking_changes)
|
||||
lastbuffer->cleanChanges();
|
||||
}
|
||||
|
||||
lastbuffer = &*(paragraphs.begin());
|
||||
while (lastbuffer->next())
|
||||
lastbuffer = lastbuffer->next();
|
||||
@ -2736,6 +2752,19 @@ void InsetText::appendParagraphs(Buffer * buffer,
|
||||
lastbuffer->next(buf);
|
||||
buf->previous(lastbuffer);
|
||||
mergeParagraph(buffer->params, paragraphs, lastbuffer);
|
||||
#else
|
||||
ParagraphList::iterator pit = plist.begin();
|
||||
ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(),
|
||||
new Paragraph(*pit, false));
|
||||
++pit;
|
||||
mergeParagraph(buffer->params, paragraphs, boost::prior(ins));
|
||||
|
||||
ParagraphList::iterator pend = plist.end();
|
||||
for (; pit != pend; ++pit) {
|
||||
paragraphs.push_back(new Paragraph(*pit, false));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
reinitLyXText();
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
///
|
||||
void writeParagraphData(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
void setParagraphData(Paragraph *, bool same_id = false);
|
||||
void setParagraphData(ParagraphList const &, bool same_id = false);
|
||||
///
|
||||
void setText(string const &, LyXFont const &);
|
||||
///
|
||||
@ -243,7 +243,7 @@ public:
|
||||
///
|
||||
void getDrawFont(LyXFont &) const;
|
||||
/// append text onto the existing text
|
||||
void appendParagraphs(Buffer * bp, Paragraph *);
|
||||
void appendParagraphs(Buffer * bp, ParagraphList &);
|
||||
|
||||
///
|
||||
void addPreview(grfx::PreviewLoader &) const;
|
||||
@ -253,6 +253,9 @@ public:
|
||||
///
|
||||
mutable int need_update;
|
||||
|
||||
bool haveParagraphs() const {
|
||||
return true;
|
||||
}
|
||||
///
|
||||
ParagraphList paragraphs;
|
||||
protected:
|
||||
@ -335,7 +338,7 @@ private:
|
||||
///
|
||||
lyx::pos_type cpos(BufferView *) const;
|
||||
///
|
||||
Paragraph * cpar(BufferView *) const;
|
||||
ParagraphList::iterator cpar(BufferView *) const;
|
||||
///
|
||||
bool cboundary(BufferView *) const;
|
||||
///
|
||||
@ -365,7 +368,7 @@ private:
|
||||
///
|
||||
mutable int top_y;
|
||||
///
|
||||
Paragraph * inset_par;
|
||||
ParagraphList::iterator inset_par;
|
||||
///
|
||||
lyx::pos_type inset_pos;
|
||||
///
|
||||
@ -381,7 +384,7 @@ private:
|
||||
///
|
||||
UpdatableInset * the_locking_inset;
|
||||
///
|
||||
mutable Paragraph * old_par;
|
||||
mutable ParagraphList::iterator old_par;
|
||||
/// The cache.
|
||||
mutable Cache cache;
|
||||
///
|
||||
|
@ -129,7 +129,7 @@ LyXTabular::LyXTabular(BufferParams const & bp,
|
||||
for (int i = 0; i < rows_; ++i) {
|
||||
for (int j = 0; j < columns_; ++j) {
|
||||
cell_info[i][j].inset.id(lt.cell_info[i][j].inset.id());
|
||||
cell_info[i][j].inset.setParagraphData(&*lt.cell_info[i][j].inset.paragraphs.begin(), true);
|
||||
cell_info[i][j].inset.setParagraphData(lt.cell_info[i][j].inset.paragraphs, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1338,7 +1338,7 @@ void LyXTabular::SetMultiColumn(Buffer * buffer, int cell, int number)
|
||||
for (int i = 1; i < number; ++i) {
|
||||
cellinfo_of_cell(cell+i)->multicolumn = CELL_PART_OF_MULTICOLUMN;
|
||||
cellinfo_of_cell(cell)->inset.appendParagraphs(buffer,
|
||||
&*cellinfo_of_cell(cell+i)->inset.paragraphs.begin());
|
||||
cellinfo_of_cell(cell+i)->inset.paragraphs);
|
||||
cellinfo_of_cell(cell+i)->inset.clear(false);
|
||||
}
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user