From ccf6e7bb7ece9566362703edbe7df576f82fb073 Mon Sep 17 00:00:00 2001 From: bancika Date: Thu, 27 Apr 2017 13:17:14 +0200 Subject: [PATCH] improve bring to front/back --- .../src/org/diylc/presenter/Presenter.java | 52 ++++++++++--------- diylc/diylc-swing/update.xml | 2 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index 198b3327..12019309 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -1536,18 +1536,20 @@ public class Presenter implements IPlugInPort { } else while (index > 0) { IDIYComponent componentBefore = currentProject.getComponents().get(index - 1); - ComponentType componentBeforeType = - ComponentProcessor.getInstance().extractComponentTypeFrom( - (Class>) componentBefore.getClass()); - if (!componentType.isFlexibleZOrder() - && Math.round(componentBeforeType.getZOrder()) < Math.round(componentType.getZOrder()) - && forceConfirmation != IView.YES_OPTION - && (forceConfirmation = - this.view - .showConfirmDialog( - "Selected component(s) have reached the bottom of their layer. Do you want to force the selection to the back?", - "Send Selection to Back", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE)) != IView.YES_OPTION) - break; + if (!selectedComponents.contains(componentBefore)) { + ComponentType componentBeforeType = + ComponentProcessor.getInstance().extractComponentTypeFrom( + (Class>) componentBefore.getClass()); + if (!componentType.isFlexibleZOrder() + && Math.round(componentBeforeType.getZOrder()) < Math.round(componentType.getZOrder()) + && forceConfirmation != IView.YES_OPTION + && (forceConfirmation = + this.view + .showConfirmDialog( + "Selected component(s) have reached the bottom of their layer. Do you want to force the selection to the back?", + "Send Selection to Back", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE)) != IView.YES_OPTION) + break; + } Collections.swap(currentProject.getComponents(), index, index - 1); index--; } @@ -1587,18 +1589,20 @@ public class Presenter implements IPlugInPort { } else while (index < currentProject.getComponents().size() - 1) { IDIYComponent componentAfter = currentProject.getComponents().get(index + 1); - ComponentType componentAfterType = - ComponentProcessor.getInstance().extractComponentTypeFrom( - (Class>) componentAfter.getClass()); - if (!componentType.isFlexibleZOrder() - && Math.round(componentAfterType.getZOrder()) > Math.round(componentType.getZOrder()) - && forceConfirmation != IView.YES_OPTION - && (forceConfirmation = - this.view - .showConfirmDialog( - "Selected component(s) have reached the bottom of their layer. Do you want to force the selection to the back?", - "Send Selection to Back", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE)) != IView.YES_OPTION) - break; + if (!selectedComponents.contains(componentAfter)) { + ComponentType componentAfterType = + ComponentProcessor.getInstance().extractComponentTypeFrom( + (Class>) componentAfter.getClass()); + if (!componentType.isFlexibleZOrder() + && Math.round(componentAfterType.getZOrder()) > Math.round(componentType.getZOrder()) + && forceConfirmation != IView.YES_OPTION + && (forceConfirmation = + this.view + .showConfirmDialog( + "Selected component(s) have reached the bottom of their layer. Do you want to force the selection to the back?", + "Send Selection to Back", IView.YES_NO_OPTION, IView.QUESTION_MESSAGE)) != IView.YES_OPTION) + break; + } Collections.swap(currentProject.getComponents(), index, index + 1); index++; } diff --git a/diylc/diylc-swing/update.xml b/diylc/diylc-swing/update.xml index fbbb91bc..feb080e9 100644 --- a/diylc/diylc-swing/update.xml +++ b/diylc/diylc-swing/update.xml @@ -1768,7 +1768,7 @@ NEW_FEATURE - Ability to force components to the front or back of other components even outisde their designated layer + Ability to force components to the front or back of other components even outisde their designated layers, allowing placing components or jumpers below boards, etc. IMPROVEMENT