From: Jean-Marc Lasgouttes Date: Wed, 17 Sep 2008 14:54:37 +0000 (+0000) Subject: re-implement correctly undo for graphics groups unification X-Git-Tag: 1.6.10~3433 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fafc1b1d3d66ccc182f73e630d458202cde99922;p=features.git re-implement correctly undo for graphics groups unification git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26429 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index da3a721b48..fc3163b784 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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; diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 2bd0cae111..ac3fe4642e 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -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(*it); InsetGraphicsParams inspar = ins.getParams(); if (params.groupId == inspar.groupId) { + b.undo().recordUndo(it); params.filename = inspar.filename; ins.setParams(params); } } } - + b.undo().endUndoGroup(); } diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index d2ab83f32b..6d0c51f404 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -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 &); }