+ case LFUN_GRAPHICS_UNIFY: {
+
+ cur.recordUndoFullBuffer();
+
+ DocIterator from, to;
+ from = cur.selectionBegin();
+ to = cur.selectionEnd();
+
+ string const newId = cmd.getArg(0);
+ bool fetchId = newId.empty(); //if we wait for groupId from first graphics inset
+
+ InsetGraphicsParams grp_par;
+ if (!fetchId)
+ InsetGraphics::string2params(graphics::getGroupParams(buffer_, newId), buffer_, grp_par);
+
+ if (!from.nextInset()) //move to closest inset
+ from.forwardInset();
+
+ while (!from.empty() && from < to) {
+ Inset * inset = from.nextInset();
+ if (!inset)
+ break;
+ InsetGraphics * ig = inset->asInsetGraphics();
+ if (ig) {
+ InsetGraphicsParams inspar = ig->getParams();
+ if (fetchId) {
+ grp_par = inspar;
+ fetchId = false;
+ } else {
+ grp_par.filename = inspar.filename;
+ ig->setParams(grp_par);
+ }
+ }
+ from.forwardInset();
+ }
+ dr.screenUpdate(Update::Force); //needed if triggered from context menu
+ break;
+ }
+