]> git.lyx.org Git - lyx.git/commitdiff
Hopefully fixed the redo problems with insets!
authorJürgen Vigna <jug@sad.it>
Fri, 30 Nov 2001 16:10:24 +0000 (16:10 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 30 Nov 2001 16:10:24 +0000 (16:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3127 a592a061-630c-0410-9148-cb99ea01b6c8

Makefile.am
src/ChangeLog
src/insets/ChangeLog
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/tabular.C
src/tabular.h
src/undo_funcs.C

index 74c3db4fdea8545bd3d5d00149ade94483830c05..5f849c4c3f90c441073dc4afd3872362698d7ff3 100644 (file)
@@ -11,7 +11,7 @@ EXTRA_DIST = ANNOUNCE INSTALL.OS2 INSTALL.autoconf README.OS2 \
        UPGRADING lyx.man acconfig.h autogen.sh \
        config development forms images sourcedoc
 
-ETAGS_ARGS = --lang=c++
+#ETAGS_ARGS = --language-force=c++
 man_MANS = lyx.1
 
 ## Needed by bindist
index 902bf4919b2fe97f5ec47cf4c04a2b2ae0a77c8b..d07fb1c5aedac955d165e9cca07ec3862b23d9eb 100644 (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>
 
        * vspace.[Ch]: cosmetical changes
index a1f43772a23360b1c77c0e2c2c2568875b6888f8..89aa9820823c62544e2eefa80de96e8d89a68e72 100644 (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>
 
        * inseturl.[Ch]:
index 1b4f42bd10af6e98de7c6e8722e0a4a87ea44d02..703c29742d7df88381a4166160ea3fd6acfcd7c0 100644 (file)
@@ -148,7 +148,7 @@ InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf,
                                                   bool same_id)
        : 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;
        locked = no_selection = false;
        oldcell = -1;
index d313c0daa2c550b057c81da5cf97768ddff222f2..c05b94713fe49bc58258c281f2e66036e48b896f 100644 (file)
@@ -161,7 +161,7 @@ InsetText & InsetText::operator=(InsetText const & it)
 void InsetText::init(InsetText const * ins, bool same_id)
 {
        if (ins) {
-               setParagraphData(ins->par);
+               setParagraphData(ins->par, same_id);
                autoBreakRows = ins->autoBreakRows;
                drawFrame_ = ins->drawFrame_;
                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
        the_locking_inset = 0;
@@ -1933,12 +1933,12 @@ void InsetText::setParagraphData(Paragraph * p)
                par = tmp;
        }
 
-       par = new Paragraph(*p, false);
+       par = new Paragraph(*p, same_id);
        par->setInsetOwner(this);
        Paragraph * np = par;
        while (p->next()) {
                p = p->next();
-               np->next(new Paragraph(*p, false));
+               np->next(new Paragraph(*p, same_id));
                np->next()->previous(np);
                np = np->next();
                np->setInsetOwner(this);
@@ -2288,7 +2288,6 @@ Paragraph * InsetText::getParFromID(int id) const
        Paragraph * tmp = par;
        while (tmp) {
                int tmp_id = tmp->id();
-               lyxerr << "Looking at paragraph: " << tmp_id << endl;
                if (tmp->id() == id) {
                        return tmp;
                }
index e96360f2a95e7a59a7b41ac705d765a780d4dbb6..0938e43e87fcbfa823ef7b632d793cd19323da4b 100644 (file)
@@ -176,7 +176,7 @@ public:
        ///
        void writeParagraphData(Buffer const *, std::ostream &) const;
        ///
-       void setParagraphData(Paragraph *);
+       void setParagraphData(Paragraph *, bool same_id = false);
        ///
        void setText(string const &);
        ///
index 1445ad1818e07dd13337623881ad1980f65c4e04..5213651290be0272b317d78b35e5836db4a69e27 100644 (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;
        cur_cell = -1;
        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
 #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)
@@ -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
        // don't know if this is good but I need to Clone also
        // the text-insets here, this is for the Undo-facility!
index e660ba2f57b1783909f463b2be0ac0f7cbc1b4b1..d48e8eaa8446ce91876a9b2018aa99774e9021fc 100644 (file)
@@ -174,14 +174,14 @@ public:
        ///
        LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
        ///
-       LyXTabular(InsetTabular *, LyXTabular const &);
+       LyXTabular(InsetTabular *, LyXTabular const &, bool same_id = false);
        ///
        explicit
        LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
        ///
        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
        bool TopLine(int cell, bool onlycolumn = false) const;
index 56b53ec745517dd9df85878b2189693875fed901..e010d5773dcdede4624ca91a57a538b0d82a4f9e 100644 (file)
@@ -226,6 +226,7 @@ void setRedo(BufferView * bv, Undo::undo_kind kind,
        bv->buffer()->redostack.push(createUndo(bv, kind, first, behind));
 }
 
+using lyx::pos_type;
 
 Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
                   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 * end = 0;
 
-#if 0
-       if (first)
-               start = const_cast<Paragraph*>(before->next());
-       else
-               start = firstUndoParagraph(bv);
-#endif
        if (behind)
                end = const_cast<Paragraph*>(behind->previous());
        else {