Some actions do not register with Undo/Redo mechanism: project font,

layer settings, group/ungroup.
This commit is contained in:
Branislav Stojkovic
2019-01-11 20:10:25 +01:00
parent 2f76bb8446
commit 7ca6eb0e2f
3 changed files with 42 additions and 3 deletions
@@ -256,6 +256,31 @@ public class Project implements Serializable {
return false;
} else if (!width.equals(other.width))
return false;
if (gridSpacing == null) {
if (other.gridSpacing != null)
return false;
} else if (!gridSpacing.equals(other.gridSpacing))
return false;
if (font == null) {
if (other.font != null)
return false;
} else if (!font.equals(other.font))
return false;
if (groups == null) {
if (other.groups != null)
return false;
} else if (!groups.equals(other.groups))
return false;
if (lockedLayers == null) {
if (other.lockedLayers != null)
return false;
} else if (!lockedLayers.equals(other.lockedLayers))
return false;
if (hiddenLayers == null) {
if (other.hiddenLayers != null)
return false;
} else if (!hiddenLayers.equals(other.hiddenLayers))
return false;
return true;
}
@@ -1592,6 +1592,7 @@ public class Presenter implements IPlugInPort {
@Override
public void setLayerLocked(int layerZOrder, boolean locked) {
LOG.info(String.format("setLayerLocked(%s, %s)", layerZOrder, locked));
Project oldProject = currentProject.clone();
if (locked) {
currentProject.getLockedLayers().add(layerZOrder);
} else {
@@ -1600,11 +1601,16 @@ public class Presenter implements IPlugInPort {
updateSelection(EMPTY_SELECTION);
messageDispatcher.dispatchMessage(EventType.REPAINT);
messageDispatcher.dispatchMessage(EventType.LAYER_STATE_CHANGED, currentProject.getLockedLayers());
if (!oldProject.equals(currentProject)) {
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), locked ? "Lock Layer" : "Unlock Layer");
projectFileManager.notifyFileChange();
}
}
@Override
public void setLayerVisibility(int layerZOrder, boolean visible) {
LOG.info(String.format("setLayerVisibility(%s, %s)", layerZOrder, visible));
Project oldProject = currentProject.clone();
if (visible) {
currentProject.getHiddenLayers().remove(layerZOrder);
} else {
@@ -1613,6 +1619,10 @@ public class Presenter implements IPlugInPort {
updateSelection(EMPTY_SELECTION);
messageDispatcher.dispatchMessage(EventType.REPAINT);
messageDispatcher.dispatchMessage(EventType.LAYER_VISIBILITY_CHANGED, currentProject.getHiddenLayers());
if (!oldProject.equals(currentProject)) {
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(), visible ? "Show Layer" : "Hide Layer");
projectFileManager.notifyFileChange();
}
}
@SuppressWarnings("unchecked")
+6 -2
View File
@@ -2140,7 +2140,7 @@
<changes>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Added "Label Orientation" property to leaded components that can be used to force labels to be rendered horizontally instead of following component placement direction</description>
<description>Added "Label Orientation" property to leaded components that can be used to force component labels to be rendered horizontally instead of following component placement direction</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
@@ -2172,7 +2172,11 @@
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>When loaded from an existing file "Potentiometer Symbol" doesn't retain the specified orientation</description>
<description>Some actions do not register with Undo/Redo mechanism: project font, layer settings, group/ungroup</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>When loaded from an existing file, "Potentiometer Symbol" doesn't retain the specified orientation</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>