Le 08/02/2018 à 22:00, Pavel Sanda a écrit :
commit b88ed81e7f1d2f59bb606351d95e093380b4eead
Author: Pavel Sanda <sa...@lyx.org>
Date:   Thu Feb 8 21:33:37 2018 +0100

     Unify graphics-groups inside marked block functionality.

Is there a reason why this should not do the whole document when there is no selection?

A few remarks below:

+       case LFUN_GRAPHICS_UNIFY: {
+
+               cur.recordUndoFullBuffer();

If you only wan tthe 'selection' case, cur.recordUndo() will do the right thing (record the selection).

+               string newId = cmd.getArg(0);

constify

+               bool fetchId=newId.empty(); //if we wait for groupId from first 
graphics inset

Spacing around =.

+
+               InsetGraphicsParams grp_par;
+               InsetGraphics::string2params(graphics::getGroupParams(buffer_, 
newId), buffer_, grp_par);

So this is set to some value even if no newId is given?

+
+               if (!from.nextInset())  //move to closest inset
+                       from.forwardInset();
+
+               while (!from.empty() && from < to) {
+                       Inset * inset = from.nextInset();
+                       if (!inset)
+                               break;
+                       if (inset->lyxCode() == GRAPHICS_CODE) {
+                               InsetGraphics * ig = inset->asInsetGraphics();
> +                          if (!ig)
> +                                  break;

Contrary to what I told you to do, it seems that here asInsetGraphics already does the correct check. You can use:
                        InsetGraphics * ig = inset->asInsetGraphics();
                        if (!ig) {
                                ....

+                               InsetGraphicsParams inspar = ig->getParams();
+                               if (fetchId) {
+                                       grp_par = inspar;
+                                       fetchId = false;
+
+                               } else {

Empty line

+                                       grp_par.filename = inspar.filename;
+                                       ig->setParams(grp_par);
+                               }
+                       }
+                       from.forwardInset();
+               }
+               dr.screenUpdate(Update::Force); //needed if triggered from 
context menu
+               break;
+       }

Reply via email to