mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
When in "Highlight Connected Area" mode, the status bar shows useful
information making it harder to forget what the mode does
This commit is contained in:
@@ -85,8 +85,8 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Hi-Quality Rendering",
|
ActionFactory.getInstance().createConfigAction(plugInPort, "Hi-Quality Rendering",
|
||||||
IPlugInPort.HI_QUALITY_RENDER_KEY, false), CONFIG_MENU);
|
IPlugInPort.HI_QUALITY_RENDER_KEY, false), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(
|
swingUI.injectMenuAction(
|
||||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Highlight Connected Areas",
|
ActionFactory.getInstance().createConfigAction(plugInPort, "Highlight Connected Areas", IPlugInPort.HIGHLIGHT_CONTINUITY_AREA,
|
||||||
IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false, IPlugInPort.HIGHLIGHT_CONTINUITY_AREA), CONFIG_MENU);
|
false), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(
|
swingUI.injectMenuAction(
|
||||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Mouse Wheel Zoom", IPlugInPort.WHEEL_ZOOM_KEY,
|
ActionFactory.getInstance().createConfigAction(plugInPort, "Mouse Wheel Zoom", IPlugInPort.WHEEL_ZOOM_KEY,
|
||||||
false), CONFIG_MENU);
|
false), CONFIG_MENU);
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(StatusBar.class);
|
private static final Logger LOG = Logger.getLogger(StatusBar.class);
|
||||||
|
|
||||||
public static String UPDATE_URL = "http://www.diy-fever.com/update.xml";
|
public static String UPDATE_URL = "http://www.diy-fever.com/update.xml";
|
||||||
|
private static String HIGHLIGHT_CONNECTED_TIP = "Click on a component to highlight area directly or indirectly connected to the area below the cursor. To continue editing, this mode needs to be switched OFF";
|
||||||
private static final Format sizeFormat = new DecimalFormat("0.##");
|
private static final Format sizeFormat = new DecimalFormat("0.##");
|
||||||
|
|
||||||
private JComboBox zoomBox;
|
private JComboBox zoomBox;
|
||||||
@@ -92,7 +93,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
private MemoryBar memoryPanel;
|
private MemoryBar memoryPanel;
|
||||||
private JLabel statusLabel;
|
private JLabel statusLabel;
|
||||||
private JLabel positionLabel;
|
private JLabel positionLabel;
|
||||||
private JLabel sizeLabel;
|
private JLabel sizeLabel;
|
||||||
|
|
||||||
private IPlugInPort plugInPort;
|
private IPlugInPort plugInPort;
|
||||||
private ISwingUI swingUI;
|
private ISwingUI swingUI;
|
||||||
@@ -169,6 +170,14 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
public void valueChanged(String key, Object value) {
|
public void valueChanged(String key, Object value) {
|
||||||
refreshPosition((Boolean)value);
|
refreshPosition((Boolean)value);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, new IConfigListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void valueChanged(String key, Object value) {
|
||||||
|
refreshStatusText();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,6 +472,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
break;
|
break;
|
||||||
case STATUS_MESSAGE_CHANGED:
|
case STATUS_MESSAGE_CHANGED:
|
||||||
statusMessage = (String) params[0];
|
statusMessage = (String) params[0];
|
||||||
|
refreshStatusText();
|
||||||
break;
|
break;
|
||||||
case MOUSE_MOVED:
|
case MOUSE_MOVED:
|
||||||
mousePositionIn = (Point2D) params[1];
|
mousePositionIn = (Point2D) params[1];
|
||||||
@@ -487,7 +497,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
getPositionLabel().setText(String.format("x:%.2f%s y:%.2f%s", mousePosition.getX(), unit, mousePosition.getY(), unit));
|
getPositionLabel().setText(String.format("x:%.2f%s y:%.2f%s", mousePosition.getX(), unit, mousePosition.getY(), unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshStatusText() {
|
private void refreshStatusText() {
|
||||||
String statusText = this.statusMessage;
|
String statusText = this.statusMessage;
|
||||||
if (componentSlot == null) {
|
if (componentSlot == null) {
|
||||||
if (componentNamesUnderCursor != null && !componentNamesUnderCursor.isEmpty()) {
|
if (componentNamesUnderCursor != null && !componentNamesUnderCursor.isEmpty()) {
|
||||||
@@ -534,6 +544,11 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// override any other status with this when in highlight mode, as we cannot do anything else
|
||||||
|
Boolean highlightConnectedAreasMode = ConfigurationManager.getInstance().readBoolean(IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false);
|
||||||
|
if (highlightConnectedAreasMode)
|
||||||
|
statusText = HIGHLIGHT_CONNECTED_TIP;
|
||||||
|
|
||||||
final String finalStatus = statusText;
|
final String finalStatus = statusText;
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|||||||
@@ -2581,7 +2581,11 @@
|
|||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Ability to tag components and building blocks as favorites</description>
|
<description>Ability to tag components and building blocks as favorites</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>When in "Highlight Connected Area" mode, the status bar shows useful information making it harder to forget what the mode does</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>"Highlight Connected Areas" doesn't follow multiple chained wires and jumpers</description>
|
<description>"Highlight Connected Areas" doesn't follow multiple chained wires and jumpers</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user