* [#15058](http://bugzilla.scilab.org/show_bug.cgi?id=15058): With integers, `gcd` and `lcm` could return a negative result, depending on the order of negative components.
* [#15060](http://bugzilla.scilab.org/show_bug.cgi?id=15060): `fplot3d` did not draw because of an addition with an empty matrix which now returns an empty matrix.
* [#15063](http://bugzilla.scilab.org/show_bug.cgi?id=15063): `fort` wasn't properly removed.
+* [#15066](http://bugzilla.scilab.org/show_bug.cgi?id=15066): Undo did not update ports positions
* [#15070](http://bugzilla.scilab.org/show_bug.cgi?id=15070): `bitset` failed when the bit position is specified as encoded integer.
* [#15072](http://bugzilla.scilab.org/show_bug.cgi?id=15072): The context was stored as a root diagram attribute instead of being stored on each Superblock layer.
* [#15079](http://bugzilla.scilab.org/show_bug.cgi?id=15079): When all children of a graphic handle have not the same number of sub-children, any vectorized extraction or insertion in subchildren failed.
* [#15261](http://bugzilla.scilab.org/show_bug.cgi?id=15261): Insertion in struct felt with wrong default value.
* [#15266](http://bugzilla.scilab.org/show_bug.cgi?id=15266): Wrong default out_mode in `linear_interpn`.
* [#15273](http://bugzilla.scilab.org/show_bug.cgi?id=15273): The documented order of `eval_cshep2d` second derivatives was wrong.
+* [#15278](http://bugzilla.scilab.org/show_bug.cgi?id=15278): Moving Xcos blocks reverted rotation and flip/mirror properties
* [#15282](http://bugzilla.scilab.org/show_bug.cgi?id=15282): `help_from_sci` could set an xml:id starting with the forbidden `%` character.
* [#15285](http://bugzilla.scilab.org/show_bug.cgi?id=15285): `resize_matrix` did not manage conversion into `int64` and `uint64`.
* [#15300](http://bugzilla.scilab.org/show_bug.cgi?id=15300): Distributive assignments like `a=(1,2)` crashed Scilab.
controller.setObjectProperty(uid, Kind.PORT, ObjectProperties.PORT_KIND, portKind.ordinal());
this.orientation = orientation;
- setLabelPosition(orientation);
+ setStyle(computeLabelPosition(orientation));
}
/**
public final void setOrientation(Orientation defaultOrientation) {
if (orientation != defaultOrientation) {
orientation = defaultOrientation;
- setLabelPosition(orientation);
+ setStyle(computeLabelPosition(orientation));
}
}
*
* @param current
* the port orientation, if null, does nothing.
+ * @return an updated style for the orientation
*/
- public final void setLabelPosition(final Orientation current) {
+ public final String computeLabelPosition(final Orientation current) {
if (current != null) {
StyleMap style = new StyleMap(getStyle());
style.put(mxConstants.STYLE_VERTICAL_ALIGN, current.getVerticalLabelPosition());
style.put(mxConstants.STYLE_SPACING, Double.toString(BasicPort.DEFAULT_PORTSIZE + 2.0));
- setStyle(style.toString());
+ return style.toString();
}
+
+ return getStyle();
}
/**
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2009 - DIGITEO - Antoine ELIAS
* Copyright (C) 2011-2015 - Scilab Enterprises - Clement DAVID
+ * Copyright (C) 2018 - ESI Group - Clement DAVID
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
diag.getModel().beginUpdate();
for (int i = 0; i < portsSize; ++i) {
final BasicPort port = (ports.get(i));
- final mxGeometry portGeom = port.getGeometry();
+ final mxGeometry portGeom = (mxGeometry) port.getGeometry().clone();
double nonVariantPosition = -portGeom.getWidth();
final int order = i;
portGeom.setX(nonVariantPosition);
portGeom.setY(alignedPosition);
- port.setLabelPosition(Orientation.WEST);
+ diag.getModel().setGeometry(port, portGeom);
+ diag.getModel().setStyle(port, port.computeLabelPosition(Orientation.WEST));
}
diag.getModel().endUpdate();
}
diag.getModel().beginUpdate();
for (int i = 0; i < portsSize; ++i) {
final BasicPort port = (ports.get(i));
- final mxGeometry portGeom = port.getGeometry();
+ final mxGeometry portGeom = (mxGeometry) port.getGeometry().clone();
double nonVariantPosition = -portGeom.getHeight();
final int order = i;
portGeom.setX(alignedPosition);
portGeom.setY(nonVariantPosition);
- port.setLabelPosition(Orientation.NORTH);
+ diag.getModel().setGeometry(port, portGeom);
+ diag.getModel().setStyle(port, port.computeLabelPosition(Orientation.NORTH));
}
diag.getModel().endUpdate();
}
diag.getModel().beginUpdate();
for (int i = 0; i < portsSize; ++i) {
final BasicPort port = (ports.get(i));
- final mxGeometry portGeom = port.getGeometry();
+ final mxGeometry portGeom = (mxGeometry) port.getGeometry().clone();
double nonVariantPosition = blockGeom.getWidth();
final int order = i;
portGeom.setX(nonVariantPosition);
portGeom.setY(alignedPosition);
- port.setLabelPosition(Orientation.EAST);
+ diag.getModel().setGeometry(port, portGeom);
+ diag.getModel().setStyle(port, port.computeLabelPosition(Orientation.EAST));
}
diag.getModel().endUpdate();
}
diag.getModel().beginUpdate();
for (int i = 0; i < portsSize; ++i) {
final BasicPort port = (ports.get(i));
- final mxGeometry portGeom = port.getGeometry();
+ final mxGeometry portGeom = (mxGeometry) port.getGeometry().clone();
double nonVariantPosition = blockGeom.getHeight();
final int order = i;
portGeom.setX(alignedPosition);
portGeom.setY(nonVariantPosition);
- port.setLabelPosition(Orientation.SOUTH);
+ diag.getModel().setGeometry(port, portGeom);
+ diag.getModel().setStyle(port, port.computeLabelPosition(Orientation.SOUTH));
}
diag.getModel().endUpdate();
}
* The block to work on
*/
public static void toggleFlip(final XcosDiagram diag, BasicBlock block) {
- JavaController controller = new JavaController();
- String[] style = new String[1];
- controller.getObjectProperty(block.getUID(), Kind.BLOCK, ObjectProperties.STYLE, style);
-
- StyleMap styleMap = new StyleMap(style[0]);
+ StyleMap styleMap = new StyleMap(block.getStyle());
final boolean invertedFlip = ! Boolean.TRUE.toString().equals(styleMap.get(XcosConstants.STYLE_FLIP));
styleMap.put(XcosConstants.STYLE_FLIP, Boolean.toString(invertedFlip));
- controller.setObjectProperty(block.getUID(), Kind.BLOCK, ObjectProperties.STYLE, styleMap.toString());
-
+ diag.getModel().setStyle(block, styleMap.toString());
updateBlockView(diag, block);
}
* The block to work on
*/
public static void toggleMirror(final XcosDiagram diag, BasicBlock block) {
- JavaController controller = new JavaController();
- String[] style = new String[1];
- controller.getObjectProperty(block.getUID(), Kind.BLOCK, ObjectProperties.STYLE, style);
-
- StyleMap styleMap = new StyleMap(style[0]);
+ StyleMap styleMap = new StyleMap(block.getStyle());
final boolean invertedFlip = ! Boolean.TRUE.toString().equals(styleMap.get(XcosConstants.STYLE_MIRROR));
styleMap.put(XcosConstants.STYLE_MIRROR, Boolean.toString(invertedFlip));
- controller.setObjectProperty(block.getUID(), Kind.BLOCK, ObjectProperties.STYLE, styleMap.toString());
-
+ diag.getModel().setStyle(block, styleMap.toString());
updateBlockView(diag, block);
}
* The block to work on
*/
public static void toggleAntiClockwiseRotation(final XcosDiagram diag, BasicBlock block) {
- JavaController controller = new JavaController();
- String[] style = new String[1];
- controller.getObjectProperty(block.getUID(), Kind.BLOCK, ObjectProperties.STYLE, style);
-
- StyleMap styleMap = new StyleMap(style[0]);
+ StyleMap styleMap = new StyleMap(block.getStyle());
styleMap.put(XcosConstants.STYLE_ROTATION, Integer.toString(getNextAntiClockwiseAngle(styleMap)));
- controller.setObjectProperty(block.getUID(), Kind.BLOCK, ObjectProperties.STYLE, styleMap.toString());
+ diag.getModel().setStyle(block, styleMap.toString());
updateBlockView(diag, block);
}