]> git.lyx.org Git - features.git/commitdiff
re-implement correctly undo for graphics groups unification
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 17 Sep 2008 14:54:37 +0000 (14:54 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 17 Sep 2008 14:54:37 +0000 (14:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26429 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h

index da3a721b48bd8b52573cd045eee15dd07cf9c40a..fc3163b7848302efbc0570d59d24af90050362c9 100644 (file)
@@ -1432,7 +1432,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
        case LFUN_GRAPHICS_GROUPS_UNIFY: {
                if (cmd.argument().empty())
                        break;
-               //view()->cursor().recordUndoFullDocument(); let inset-apply do that job
                graphics::unifyGraphicsGroups(cur.buffer(), to_utf8(cmd.argument()));
                processUpdateFlags(Update::Force | Update::FitCursor);
                break;
index 2bd0cae1118a9aff97be69506576ac5a0dda2480..ac3fe4642eab52825206e1cbe32356216849dc7f 100644 (file)
@@ -987,11 +987,12 @@ string getGroupParams(Buffer const & b, string const & groupId)
 }
 
 
-void unifyGraphicsGroups(Buffer const & b, string const & argument)
+void unifyGraphicsGroups(Buffer & b, string const & argument)
 {
        InsetGraphicsParams params;
        InsetGraphics::string2params(argument, b, params);
 
+       b.undo().beginUndoGroup();
        Inset & inset = b.inset();
        InsetIterator it  = inset_iterator_begin(inset);
        InsetIterator const end = inset_iterator_end(inset);
@@ -1000,12 +1001,13 @@ void unifyGraphicsGroups(Buffer const & b, string const & argument)
                        InsetGraphics & ins = static_cast<InsetGraphics &>(*it);
                        InsetGraphicsParams inspar = ins.getParams();
                        if (params.groupId == inspar.groupId) {
+                               b.undo().recordUndo(it);
                                params.filename = inspar.filename;
                                ins.setParams(params);
                        }
                }
        }
-
+       b.undo().endUndoGroup();
 }
 
 
index d2ab83f32b11985457aa28415617c4eab2fbeb75..6d0c51f404f150bb145606e33ddc1619bed144eb 100644 (file)
@@ -134,7 +134,7 @@ namespace graphics {
        /** Synchronize all Graphics insets of the group.
            Both groupId and params are taken from argument.
        */
-       void unifyGraphicsGroups(Buffer const &,        std::string const &);
+       void unifyGraphicsGroups(Buffer &, std::string const &);
        InsetGraphics * getCurrentGraphicsInset(Cursor const &);
 
 }