From 46f20a75ecfdf4942b7016e44864b7b7676027a8 Mon Sep 17 00:00:00 2001 From: Branislav Stojkovic Date: Sat, 2 Feb 2019 12:44:59 +0100 Subject: [PATCH] better status bar text when dragging a component from the tree --- .../src/org/diylc/presenter/Presenter.java | 6 +++--- .../org/diylc/swing/plugins/statusbar/StatusBar.java | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index eaed37ce..6f6b6f9d 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -923,8 +923,8 @@ public class Presenter implements IPlugInPort { minY = rect.y; if (rect.y + rect.height > maxY) maxY = rect.y + rect.height; - } else - LOG.info("Area is null for " + c.getName() + " of type " + } else if (currentProject.getComponents().contains(c)) + LOG.debug("Area is null for " + c.getName() + " of type " + c.getClass().getName()); } if (drawingManager.getZoomLevel() != 1 && applyZoom) { @@ -2161,7 +2161,7 @@ public class Presenter implements IPlugInPort { // messageDispatcher.dispatchMessage(EventType.SELECTION_SIZE_CHANGED, // calculateSelectionDimension()); messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED, instantiationManager.getComponentTypeSlot(), - instantiationManager.getFirstControlPoint()); + instantiationManager.getFirstControlPoint(), forceInstatiate); } catch (Exception e) { LOG.error("Could not set component type slot", e); view.showMessage("Could not set component type slot. Check log for details.", "Error", IView.ERROR_MESSAGE); diff --git a/diylc/diylc-swing/src/org/diylc/swing/plugins/statusbar/StatusBar.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/statusbar/StatusBar.java index 6613c87d..2283da9e 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/plugins/statusbar/StatusBar.java +++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/statusbar/StatusBar.java @@ -95,7 +95,8 @@ public class StatusBar extends JPanel implements IPlugIn { // State variables private ComponentType componentSlot; - private Point controlPointSlot; + private Point controlPointSlot; + private Boolean forceInstatiate; private List componentNamesUnderCursor; private List selectedComponentNames; private List stuckComponentNames; @@ -419,7 +420,8 @@ public class StatusBar extends JPanel implements IPlugIn { break; case SLOT_CHANGED: componentSlot = (ComponentType) params[0]; - controlPointSlot = (Point) params[1]; + controlPointSlot = (Point) params[1]; + forceInstatiate = params.length > 2 ? (Boolean)params[2] : null; refreshStatusText(); break; case AVAILABLE_CTRL_POINTS_CHANGED: @@ -458,7 +460,11 @@ public class StatusBar extends JPanel implements IPlugIn { } statusText = "Selection: " + builder.toString() + ""; } - } else { + } else { + if (forceInstatiate) + statusText = "Drag the mouse over the canvas to place a new " + componentSlot.getName() + + ""; + else switch (componentSlot.getCreationMethod()) { case POINT_BY_POINT: String count;