better status bar text when dragging a component from the tree

This commit is contained in:
Branislav Stojkovic
2019-02-02 12:44:59 +01:00
parent 34ea20eedd
commit 46f20a75ec
2 changed files with 12 additions and 6 deletions
@@ -923,8 +923,8 @@ public class Presenter implements IPlugInPort {
minY = rect.y; minY = rect.y;
if (rect.y + rect.height > maxY) if (rect.y + rect.height > maxY)
maxY = rect.y + rect.height; maxY = rect.y + rect.height;
} else } else if (currentProject.getComponents().contains(c))
LOG.info("Area is null for " + c.getName() + " of type " LOG.debug("Area is null for " + c.getName() + " of type "
+ c.getClass().getName()); + c.getClass().getName());
} }
if (drawingManager.getZoomLevel() != 1 && applyZoom) { if (drawingManager.getZoomLevel() != 1 && applyZoom) {
@@ -2161,7 +2161,7 @@ public class Presenter implements IPlugInPort {
// messageDispatcher.dispatchMessage(EventType.SELECTION_SIZE_CHANGED, // messageDispatcher.dispatchMessage(EventType.SELECTION_SIZE_CHANGED,
// calculateSelectionDimension()); // calculateSelectionDimension());
messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED, instantiationManager.getComponentTypeSlot(), messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED, instantiationManager.getComponentTypeSlot(),
instantiationManager.getFirstControlPoint()); instantiationManager.getFirstControlPoint(), forceInstatiate);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not set component type slot", 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); view.showMessage("Could not set component type slot. Check log for details.", "Error", IView.ERROR_MESSAGE);
@@ -96,6 +96,7 @@ public class StatusBar extends JPanel implements IPlugIn {
// State variables // State variables
private ComponentType componentSlot; private ComponentType componentSlot;
private Point controlPointSlot; private Point controlPointSlot;
private Boolean forceInstatiate;
private List<String> componentNamesUnderCursor; private List<String> componentNamesUnderCursor;
private List<String> selectedComponentNames; private List<String> selectedComponentNames;
private List<String> stuckComponentNames; private List<String> stuckComponentNames;
@@ -420,6 +421,7 @@ public class StatusBar extends JPanel implements IPlugIn {
case SLOT_CHANGED: case SLOT_CHANGED:
componentSlot = (ComponentType) params[0]; componentSlot = (ComponentType) params[0];
controlPointSlot = (Point) params[1]; controlPointSlot = (Point) params[1];
forceInstatiate = params.length > 2 ? (Boolean)params[2] : null;
refreshStatusText(); refreshStatusText();
break; break;
case AVAILABLE_CTRL_POINTS_CHANGED: case AVAILABLE_CTRL_POINTS_CHANGED:
@@ -459,6 +461,10 @@ public class StatusBar extends JPanel implements IPlugIn {
statusText = "<html>Selection: " + builder.toString() + "</html>"; statusText = "<html>Selection: " + builder.toString() + "</html>";
} }
} else { } else {
if (forceInstatiate)
statusText = "<html>Drag the mouse over the canvas to place a new <font color='blue'>" + componentSlot.getName()
+ "</font></html>";
else
switch (componentSlot.getCreationMethod()) { switch (componentSlot.getCreationMethod()) {
case POINT_BY_POINT: case POINT_BY_POINT:
String count; String count;