Hopefully fixed the redo problems with insets!

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3127 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-11-30 16:10:24 +00:00
parent 9ecdf1c6c3
commit c130d5dbfd
9 changed files with 38 additions and 19 deletions

View File

@ -11,7 +11,7 @@ EXTRA_DIST = ANNOUNCE INSTALL.OS2 INSTALL.autoconf README.OS2 \
UPGRADING lyx.man acconfig.h autogen.sh \ UPGRADING lyx.man acconfig.h autogen.sh \
config development forms images sourcedoc config development forms images sourcedoc
ETAGS_ARGS = --lang=c++ #ETAGS_ARGS = --language-force=c++
man_MANS = lyx.1 man_MANS = lyx.1
## Needed by bindist ## Needed by bindist

View File

@ -1,3 +1,8 @@
2001-11-30 Juergen Vigna <jug@sad.it>
* tabular.C (LyXTabular): add a same_id to set the same id's in the
insets for undo reasons.
2001-11-28 André Pönitz <poenitz@gmx.net> 2001-11-28 André Pönitz <poenitz@gmx.net>
* vspace.[Ch]: cosmetical changes * vspace.[Ch]: cosmetical changes

View File

@ -1,3 +1,11 @@
2001-11-30 Juergen Vigna <jug@sad.it>
* insettabular.C (InsetTabular): use the save_id flag to create also
the tabular with the same id's.
* insettext.C (setParagraphData): added a same_id function for undo
to set the same paragraph id's as of the paragraph we are setting.
2001-11-30 José Matos <jamatos@fep.up.pt> 2001-11-30 José Matos <jamatos@fep.up.pt>
* inseturl.[Ch]: * inseturl.[Ch]:

View File

@ -148,7 +148,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
bool same_id) bool same_id)
: UpdatableInset(tab, same_id), buffer(&buf) : UpdatableInset(tab, same_id), buffer(&buf)
{ {
tabular.reset(new LyXTabular(this, *(tab.tabular))); tabular.reset(new LyXTabular(this, *(tab.tabular), same_id));
the_locking_inset = 0; the_locking_inset = 0;
locked = no_selection = false; locked = no_selection = false;
oldcell = -1; oldcell = -1;

View File

@ -161,7 +161,7 @@ InsetText & InsetText::operator=(InsetText const & it)
void InsetText::init(InsetText const * ins, bool same_id) void InsetText::init(InsetText const * ins, bool same_id)
{ {
if (ins) { if (ins) {
setParagraphData(ins->par); setParagraphData(ins->par, same_id);
autoBreakRows = ins->autoBreakRows; autoBreakRows = ins->autoBreakRows;
drawFrame_ = ins->drawFrame_; drawFrame_ = ins->drawFrame_;
frame_color = ins->frame_color; frame_color = ins->frame_color;
@ -1923,7 +1923,7 @@ int InsetText::getMaxWidth(BufferView * bv, UpdatableInset const * inset) const
} }
void InsetText::setParagraphData(Paragraph * p) void InsetText::setParagraphData(Paragraph * p, bool same_id)
{ {
// we have to unlock any locked inset otherwise we're in troubles // we have to unlock any locked inset otherwise we're in troubles
the_locking_inset = 0; the_locking_inset = 0;
@ -1933,12 +1933,12 @@ void InsetText::setParagraphData(Paragraph * p)
par = tmp; par = tmp;
} }
par = new Paragraph(*p, false); par = new Paragraph(*p, same_id);
par->setInsetOwner(this); par->setInsetOwner(this);
Paragraph * np = par; Paragraph * np = par;
while (p->next()) { while (p->next()) {
p = p->next(); p = p->next();
np->next(new Paragraph(*p, false)); np->next(new Paragraph(*p, same_id));
np->next()->previous(np); np->next()->previous(np);
np = np->next(); np = np->next();
np->setInsetOwner(this); np->setInsetOwner(this);
@ -2288,7 +2288,6 @@ Paragraph * InsetText::getParFromID(int id) const
Paragraph * tmp = par; Paragraph * tmp = par;
while (tmp) { while (tmp) {
int tmp_id = tmp->id(); int tmp_id = tmp->id();
lyxerr << "Looking at paragraph: " << tmp_id << endl;
if (tmp->id() == id) { if (tmp->id() == id) {
return tmp; return tmp;
} }

View File

@ -176,7 +176,7 @@ public:
/// ///
void writeParagraphData(Buffer const *, std::ostream &) const; void writeParagraphData(Buffer const *, std::ostream &) const;
/// ///
void setParagraphData(Paragraph *); void setParagraphData(Paragraph *, bool same_id = false);
/// ///
void setText(string const &); void setText(string const &);
/// ///

View File

@ -110,11 +110,23 @@ LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
} }
LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt) LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt,
bool same_id)
{ {
owner_ = inset; owner_ = inset;
cur_cell = -1; cur_cell = -1;
Init(lt.rows_, lt.columns_, &lt); Init(lt.rows_, lt.columns_, &lt);
// we really should change again to have InsetText as a pointer
// and allocate it then we would not have to do this stuff all
// double!
if (same_id) {
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.paragraph(),true);
}
}
}
#if 0 #if 0
#ifdef WITH_WARNINGS #ifdef WITH_WARNINGS
#warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb) #warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
@ -164,9 +176,9 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
} }
LyXTabular * LyXTabular::clone(InsetTabular * inset) LyXTabular * LyXTabular::clone(InsetTabular * inset, bool same_id)
{ {
LyXTabular * result = new LyXTabular(inset, *this); LyXTabular * result = new LyXTabular(inset, *this, same_id);
#if 0 #if 0
// don't know if this is good but I need to Clone also // don't know if this is good but I need to Clone also
// the text-insets here, this is for the Undo-facility! // the text-insets here, this is for the Undo-facility!

View File

@ -174,14 +174,14 @@ public:
/// ///
LyXTabular(InsetTabular *, int columns_arg, int rows_arg); LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
/// ///
LyXTabular(InsetTabular *, LyXTabular const &); LyXTabular(InsetTabular *, LyXTabular const &, bool same_id = false);
/// ///
explicit explicit
LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex); LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
/// ///
LyXTabular & operator=(LyXTabular const &); LyXTabular & operator=(LyXTabular const &);
/// ///
LyXTabular * clone(InsetTabular *); LyXTabular * clone(InsetTabular *, bool same_id = false);
/// Returns true if there is a topline, returns false if not /// Returns true if there is a topline, returns false if not
bool TopLine(int cell, bool onlycolumn = false) const; bool TopLine(int cell, bool onlycolumn = false) const;

View File

@ -226,6 +226,7 @@ void setRedo(BufferView * bv, Undo::undo_kind kind,
bv->buffer()->redostack.push(createUndo(bv, kind, first, behind)); bv->buffer()->redostack.push(createUndo(bv, kind, first, behind));
} }
using lyx::pos_type;
Undo * createUndo(BufferView * bv, Undo::undo_kind kind, Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
Paragraph const * first, Paragraph const * behind) Paragraph const * first, Paragraph const * behind)
@ -266,12 +267,6 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
Paragraph * start = const_cast<Paragraph *>(first); Paragraph * start = const_cast<Paragraph *>(first);
Paragraph * end = 0; Paragraph * end = 0;
#if 0
if (first)
start = const_cast<Paragraph*>(before->next());
else
start = firstUndoParagraph(bv);
#endif
if (behind) if (behind)
end = const_cast<Paragraph*>(behind->previous()); end = const_cast<Paragraph*>(behind->previous());
else { else {