mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
change tracking:
* src/paragraph.h: insertXXX(...) requires either boolean parameter 'trackChanges' or a Change * src/insets/insettext.h: add trackChanges parameter to setText(...) * src/insets/*.C: * src/*.C: adjust properly & remove a couple of FIXMEs git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15399 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4656a5e16a
commit
b08f5ad69e
@ -610,7 +610,8 @@ void copySelection(LCursor & cur)
|
|||||||
BufferParams const & bp = cur.buffer().params();
|
BufferParams const & bp = cur.buffer().params();
|
||||||
pars.back().layout(bp.getLyXTextClass().defaultLayout());
|
pars.back().layout(bp.getLyXTextClass().defaultLayout());
|
||||||
for_each(pars.begin(), pars.end(), resetParagraph(cur.buffer()));
|
for_each(pars.begin(), pars.end(), resetParagraph(cur.buffer()));
|
||||||
pars.back().insert(0, grabSelection(cur), LyXFont());
|
// FIXME: change tracking (MG)
|
||||||
|
pars.back().insert(0, grabSelection(cur), LyXFont(), Change(Change::UNCHANGED));
|
||||||
theCuts.push(make_pair(pars, bp.textclass));
|
theCuts.push(make_pair(pars, bp.textclass));
|
||||||
}
|
}
|
||||||
// tell tabular that a recent copy happened
|
// tell tabular that a recent copy happened
|
||||||
@ -679,8 +680,7 @@ void replaceSelectionWithString(LCursor & cur, string const & str, bool backward
|
|||||||
string::const_iterator cit = str.begin();
|
string::const_iterator cit = str.begin();
|
||||||
string::const_iterator end = str.end();
|
string::const_iterator end = str.end();
|
||||||
for (; cit != end; ++cit, ++pos)
|
for (; cit != end; ++cit, ++pos)
|
||||||
// FIXME: change tracking (MG)
|
par.insertChar(pos, (*cit), font, cur.buffer().params().trackChanges);
|
||||||
par.insertChar(pos, (*cit), font, Change(Change::INSERTED));
|
|
||||||
|
|
||||||
// Cut the selection
|
// Cut the selection
|
||||||
cutSelection(cur, true, false);
|
cutSelection(cur, true, false);
|
||||||
|
@ -531,15 +531,13 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
|
|||||||
} else if (*cit == '\t') {
|
} else if (*cit == '\t') {
|
||||||
if (!par.isFreeSpacing()) {
|
if (!par.isFreeSpacing()) {
|
||||||
// tabs are like spaces here
|
// tabs are like spaces here
|
||||||
// FIXME: change tracking (MG)
|
par.insertChar(pos, ' ', font, params().trackChanges);
|
||||||
par.insertChar(pos, ' ', font, Change(Change::INSERTED));
|
|
||||||
++pos;
|
++pos;
|
||||||
space_inserted = true;
|
space_inserted = true;
|
||||||
} else {
|
} else {
|
||||||
const pos_type n = 8 - pos % 8;
|
const pos_type n = 8 - pos % 8;
|
||||||
for (pos_type i = 0; i < n; ++i) {
|
for (pos_type i = 0; i < n; ++i) {
|
||||||
// FIXME: change tracking (MG)
|
par.insertChar(pos, ' ', font, params().trackChanges);
|
||||||
par.insertChar(pos, ' ', font, Change(Change::INSERTED));
|
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
space_inserted = true;
|
space_inserted = true;
|
||||||
@ -551,8 +549,7 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
|
|||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
// just insert the character
|
// just insert the character
|
||||||
// FIXME: change tracking (MG)
|
par.insertChar(pos, *cit, font, params().trackChanges);
|
||||||
par.insertChar(pos, *cit, font, Change(Change::INSERTED));
|
|
||||||
++pos;
|
++pos;
|
||||||
space_inserted = (*cit == ' ');
|
space_inserted = (*cit == ' ');
|
||||||
}
|
}
|
||||||
|
@ -1983,7 +1983,8 @@ bool InsetTabular::insertAsciiString(BufferView & bv, docstring const & buf,
|
|||||||
inset->setViewCache(&bv);
|
inset->setViewCache(&bv);
|
||||||
Paragraph & par = inset->text_.getPar(0);
|
Paragraph & par = inset->text_.getPar(0);
|
||||||
LyXFont const font = inset->text_.getFont(par, 0);
|
LyXFont const font = inset->text_.getFont(par, 0);
|
||||||
inset->setText(buf.substr(op, p - op), font);
|
inset->setText(buf.substr(op, p - op), font,
|
||||||
|
bv.buffer()->params().trackChanges);
|
||||||
++cols;
|
++cols;
|
||||||
++cell;
|
++cell;
|
||||||
}
|
}
|
||||||
@ -1995,7 +1996,8 @@ bool InsetTabular::insertAsciiString(BufferView & bv, docstring const & buf,
|
|||||||
inset->setViewCache(&bv);
|
inset->setViewCache(&bv);
|
||||||
Paragraph & par = inset->text_.getPar(0);
|
Paragraph & par = inset->text_.getPar(0);
|
||||||
LyXFont const font = inset->text_.getFont(par, 0);
|
LyXFont const font = inset->text_.getFont(par, 0);
|
||||||
inset->setText(buf.substr(op, p - op), font);
|
inset->setText(buf.substr(op, p - op), font,
|
||||||
|
bv.buffer()->params().trackChanges);
|
||||||
}
|
}
|
||||||
cols = ocol;
|
cols = ocol;
|
||||||
++row;
|
++row;
|
||||||
@ -2012,7 +2014,8 @@ bool InsetTabular::insertAsciiString(BufferView & bv, docstring const & buf,
|
|||||||
inset->setViewCache(&bv);
|
inset->setViewCache(&bv);
|
||||||
Paragraph & par = inset->text_.getPar(0);
|
Paragraph & par = inset->text_.getPar(0);
|
||||||
LyXFont const font = inset->text_.getFont(par, 0);
|
LyXFont const font = inset->text_.getFont(par, 0);
|
||||||
inset->setText(buf.substr(op, len - op), font);
|
inset->setText(buf.substr(op, len - op), font,
|
||||||
|
bv.buffer()->params().trackChanges);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -329,13 +329,12 @@ bool InsetText::showInsetDialog(BufferView *) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::setText(docstring const & data, LyXFont const & font)
|
void InsetText::setText(docstring const & data, LyXFont const & font, bool trackChanges)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
Paragraph & first = paragraphs().front();
|
Paragraph & first = paragraphs().front();
|
||||||
for (unsigned int i = 0; i < data.length(); ++i)
|
for (unsigned int i = 0; i < data.length(); ++i)
|
||||||
// FIXME: change tracking (MG)
|
first.insertChar(i, data[i], font, trackChanges);
|
||||||
first.insertChar(i, data[i], font, Change(Change::INSERTED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
///
|
///
|
||||||
Code lyxCode() const { return TEXT_CODE; }
|
Code lyxCode() const { return TEXT_CODE; }
|
||||||
///
|
///
|
||||||
void setText(lyx::docstring const &, LyXFont const &);
|
void setText(lyx::docstring const &, LyXFont const &, bool trackChanges);
|
||||||
///
|
///
|
||||||
void setAutoBreakRows(bool);
|
void setAutoBreakRows(bool);
|
||||||
///
|
///
|
||||||
|
@ -186,7 +186,9 @@ int replaceAll(BufferView * bv,
|
|||||||
LyXFont const font
|
LyXFont const font
|
||||||
= cur.paragraph().getFontSettings(buf.params(), pos);
|
= cur.paragraph().getFontSettings(buf.params(), pos);
|
||||||
int striked = ssize - cur.paragraph().erase(pos, pos + ssize);
|
int striked = ssize - cur.paragraph().erase(pos, pos + ssize);
|
||||||
cur.paragraph().insert(pos, replacestr, font);
|
cur.paragraph().insert(pos, replacestr, font,
|
||||||
|
Change(buf.params().trackChanges ?
|
||||||
|
Change::INSERTED : Change::UNCHANGED));
|
||||||
for (int i = 0; i < rsize + striked; ++i)
|
for (int i = 0; i < rsize + striked; ++i)
|
||||||
cur.forwardChar();
|
cur.forwardChar();
|
||||||
++num;
|
++num;
|
||||||
|
@ -251,23 +251,32 @@ int Paragraph::erase(pos_type start, pos_type end, bool trackChanges)
|
|||||||
|
|
||||||
|
|
||||||
void Paragraph::insert(pos_type start, string const & str,
|
void Paragraph::insert(pos_type start, string const & str,
|
||||||
LyXFont const & font)
|
LyXFont const & font, Change const & change)
|
||||||
{
|
{
|
||||||
for (size_t i = 0, n = str.size(); i != n ; ++i)
|
for (size_t i = 0, n = str.size(); i != n ; ++i)
|
||||||
// FIXME: change tracking (MG)
|
insertChar(start + i, str[i], font, change);
|
||||||
insertChar(start + i, str[i], font, Change(Change::INSERTED));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
|
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
|
||||||
Change const & change)
|
bool trackChanges)
|
||||||
{
|
{
|
||||||
pimpl_->insertChar(pos, c, change);
|
pimpl_->insertChar(pos, c, Change(trackChanges ?
|
||||||
|
Change::INSERTED : Change::UNCHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
|
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
|
||||||
LyXFont const & font, Change const & change)
|
LyXFont const & font, bool trackChanges)
|
||||||
|
{
|
||||||
|
pimpl_->insertChar(pos, c, Change(trackChanges ?
|
||||||
|
Change::INSERTED : Change::UNCHANGED));
|
||||||
|
setFont(pos, font);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
|
||||||
|
LyXFont const & font, Change const & change)
|
||||||
{
|
{
|
||||||
pimpl_->insertChar(pos, c, change);
|
pimpl_->insertChar(pos, c, change);
|
||||||
setFont(pos, font);
|
setFont(pos, font);
|
||||||
|
@ -289,18 +289,21 @@ public:
|
|||||||
LyXFont_size def_size) const;
|
LyXFont_size def_size) const;
|
||||||
///
|
///
|
||||||
void insert(lyx::pos_type pos, std::string const & str,
|
void insert(lyx::pos_type pos, std::string const & str,
|
||||||
LyXFont const & font);
|
LyXFont const & font, Change const & change);
|
||||||
///
|
///
|
||||||
void insertChar(lyx::pos_type pos, value_type c, Change const & change);
|
void insertChar(lyx::pos_type pos, value_type c, bool trackChanges);
|
||||||
///
|
///
|
||||||
void insertChar(lyx::pos_type pos, value_type c,
|
void insertChar(lyx::pos_type pos, value_type c,
|
||||||
LyXFont const &, Change const & change);
|
LyXFont const &, bool trackChanges);
|
||||||
|
///
|
||||||
|
void insertChar(lyx::pos_type pos, value_type c,
|
||||||
|
LyXFont const &, Change const & change);
|
||||||
///
|
///
|
||||||
void insertInset(lyx::pos_type pos, InsetBase * inset,
|
void insertInset(lyx::pos_type pos, InsetBase * inset,
|
||||||
Change const & change);
|
Change const & change);
|
||||||
///
|
///
|
||||||
void insertInset(lyx::pos_type pos, InsetBase * inset,
|
void insertInset(lyx::pos_type pos, InsetBase * inset,
|
||||||
LyXFont const &, Change const & change);
|
LyXFont const &, Change const & change);
|
||||||
///
|
///
|
||||||
bool insetAllowed(InsetBase_code code);
|
bool insetAllowed(InsetBase_code code);
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user