mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
Extract 'Analyze' menu, move 'Highlight Connected Areas' feature from 'Config' menu to 'Analyze' menu
This commit is contained in:
@@ -78,7 +78,6 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
|
||||
public static final String RECENT_FILES_KEY = "recentFiles";
|
||||
public static final String SHOW_RULERS_KEY = "showRulers";
|
||||
public static final String SHOW_GRID_KEY = "showGrid";
|
||||
public static final String HIGHLIGHT_CONTINUITY_AREA = "highlightContinuityArea";
|
||||
public static final String HARDWARE_ACCELERATION = "hardwareAcceleration";
|
||||
public static final String EXTRA_SPACE_KEY = "extraSpace";
|
||||
public static final String FAVORITES_KEY = "favorites";
|
||||
@@ -400,4 +399,16 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
|
||||
* @param threshold
|
||||
*/
|
||||
List<Area> checkContinuityAreaProximity(Size threshold);
|
||||
|
||||
/**
|
||||
* @return the current operation mode of the application
|
||||
*/
|
||||
OperationMode getOperationMode();
|
||||
|
||||
/**
|
||||
* Updates the current operation mode of the application
|
||||
*
|
||||
* @param operationMode
|
||||
*/
|
||||
void setOperationMode(OperationMode operationMode);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.diylc.common;
|
||||
|
||||
public enum OperationMode {
|
||||
EDIT, HIGHLIGHT_CONNECTED_AREAS
|
||||
}
|
||||
@@ -59,17 +59,7 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
|
||||
import org.diylc.clipboard.ComponentTransferable;
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.common.DrawOption;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.IComponentFilter;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
import org.diylc.common.IKeyProcessor;
|
||||
import org.diylc.common.INetlistAnalyzer;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.IProjectEditor;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.core.ExpansionMode;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDatasheetSupport;
|
||||
@@ -99,7 +89,7 @@ import org.diylc.utils.ReflectionUtils;
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public class Presenter implements IPlugInPort, IConfigListener {
|
||||
public class Presenter implements IPlugInPort {
|
||||
|
||||
private static final String REACHED_BOTTOM =
|
||||
LangUtil.translate("Selected component(s) have reached the bottom of their layer. Do you want to force the selection to the back?");
|
||||
@@ -182,6 +172,8 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
private Point2D previousScaledPoint;
|
||||
|
||||
private DIYTest test = null;
|
||||
|
||||
private OperationMode operationMode;
|
||||
|
||||
public Presenter(IView view, IConfigurationManager<?> configManager) {
|
||||
this(view, configManager, false);
|
||||
@@ -212,8 +204,6 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
variantManager.importDefaultVariants();
|
||||
buildingBlockManager.importDefaultBlocks();
|
||||
}
|
||||
|
||||
this.configManager.addConfigListener(HIGHLIGHT_CONTINUITY_AREA, this);
|
||||
}
|
||||
|
||||
public void installPlugin(Supplier<IPlugIn> plugInSupplier) {
|
||||
@@ -258,7 +248,7 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
@Override
|
||||
public Cursor getCursorAt(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||
// Only change the cursor if we're not making a new component.
|
||||
if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown)
|
||||
if (operationMode == OperationMode.HIGHLIGHT_CONNECTED_AREAS || altDown)
|
||||
return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
|
||||
if (instantiationManager.getComponentTypeSlot() == null) {
|
||||
// Scale point to remove zoom factor.
|
||||
@@ -268,7 +258,7 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
}
|
||||
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
||||
if (!isComponentLocked(component) && isComponentVisible(component)
|
||||
&& !configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||
&& operationMode != OperationMode.HIGHLIGHT_CONNECTED_AREAS) {
|
||||
ComponentArea area = drawingManager.getComponentArea(component);
|
||||
if (area != null && area.getOutlineArea() != null && scaledPoint != null && area.getOutlineArea().contains(scaledPoint)) {
|
||||
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
|
||||
@@ -610,7 +600,7 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
default:
|
||||
LOG.error("Unknown creation method: " + componentTypeSlot.getCreationMethod());
|
||||
}
|
||||
} else if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown) {
|
||||
} else if (operationMode == OperationMode.HIGHLIGHT_CONNECTED_AREAS || altDown) {
|
||||
drawingManager.findContinuityAreaAtPoint(scaledPoint);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
} else {
|
||||
@@ -1084,8 +1074,8 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
dragAction == DnDConstants.ACTION_LINK, dragAction == DnDConstants.ACTION_MOVE, 1);
|
||||
return;
|
||||
}
|
||||
if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||
LOG.debug("Cannot start drag in hightlight continuity mode.");
|
||||
if (operationMode == OperationMode.HIGHLIGHT_CONNECTED_AREAS) {
|
||||
LOG.debug("Cannot start drag in highlight continuity mode.");
|
||||
return;
|
||||
}
|
||||
this.dragInProgress = true;
|
||||
@@ -1243,7 +1233,7 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
test.addStep(DIYTest.DRAG_OVER, params);
|
||||
}
|
||||
|
||||
if (point == null || configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
||||
if (point == null || operationMode == OperationMode.HIGHLIGHT_CONNECTED_AREAS) {
|
||||
return false;
|
||||
}
|
||||
Point2D scaledPoint = scalePoint(point);
|
||||
@@ -1558,7 +1548,7 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
new Point((int)previousDragPoint.getX(), (int)previousDragPoint.getY()));;
|
||||
}
|
||||
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
||||
if (!configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false))
|
||||
if (operationMode != OperationMode.HIGHLIGHT_CONNECTED_AREAS)
|
||||
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
||||
if (!isComponentLocked(component) && isComponentVisible(component)) {
|
||||
ComponentArea area = drawingManager.getComponentArea(component);
|
||||
@@ -2748,7 +2738,7 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(result, new Comparator<INetlistAnalyzer>() {
|
||||
result.sort(new Comparator<INetlistAnalyzer>() {
|
||||
|
||||
@Override
|
||||
public int compare(INetlistAnalyzer o1, INetlistAnalyzer o2) {
|
||||
@@ -2803,18 +2793,21 @@ public class Presenter implements IPlugInPort, IConfigListener {
|
||||
public List<Area> checkContinuityAreaProximity(Size threshold) {
|
||||
return drawingManager.getContinuityAreaProximity((float)threshold.convertToPixels());
|
||||
}
|
||||
|
||||
// IConfigListener
|
||||
|
||||
@Override
|
||||
public void valueChanged(String configKey, Object value) {
|
||||
if (HIGHLIGHT_CONTINUITY_AREA.equalsIgnoreCase(configKey)) {
|
||||
drawingManager.clearContinuityArea();
|
||||
if (Boolean.TRUE.equals(value)) {
|
||||
drawingManager.clearComponentAreaMap();
|
||||
}
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
public OperationMode getOperationMode() {
|
||||
return operationMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOperationMode(OperationMode operationMode) {
|
||||
this.operationMode = operationMode;
|
||||
drawingManager.clearContinuityArea();
|
||||
if (OperationMode.HIGHLIGHT_CONNECTED_AREAS == operationMode) {
|
||||
drawingManager.clearComponentAreaMap();
|
||||
}
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
messageDispatcher.dispatchMessage(EventType.STATUS_MESSAGE_CHANGED);
|
||||
}
|
||||
|
||||
protected MessageDispatcher<EventType> getMessageDispatcher() {
|
||||
|
||||
@@ -317,6 +317,14 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added Windows zip file distribution in addition to the installer.</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Moved 'Analyze' functions from 'File' menu to their own menu for faster access</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Moved 'Highlight Connected Areas' feature from 'Config' menu to 'Analyze' menu</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Fully configurable colors for 'Mini Toggle Switch' components</description>
|
||||
|
||||
Reference in New Issue
Block a user