mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +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",
|
||||
IPlugInPort.HI_QUALITY_RENDER_KEY, false), CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Highlight Connected Areas",
|
||||
IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false, IPlugInPort.HIGHLIGHT_CONTINUITY_AREA), CONFIG_MENU);
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Highlight Connected Areas", IPlugInPort.HIGHLIGHT_CONTINUITY_AREA,
|
||||
false), CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Mouse Wheel Zoom", IPlugInPort.WHEEL_ZOOM_KEY,
|
||||
false), CONFIG_MENU);
|
||||
|
||||
@@ -82,7 +82,8 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
|
||||
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 JComboBox zoomBox;
|
||||
@@ -92,7 +93,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
private MemoryBar memoryPanel;
|
||||
private JLabel statusLabel;
|
||||
private JLabel positionLabel;
|
||||
private JLabel sizeLabel;
|
||||
private JLabel sizeLabel;
|
||||
|
||||
private IPlugInPort plugInPort;
|
||||
private ISwingUI swingUI;
|
||||
@@ -169,6 +170,14 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
public void valueChanged(String key, Object 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;
|
||||
case STATUS_MESSAGE_CHANGED:
|
||||
statusMessage = (String) params[0];
|
||||
refreshStatusText();
|
||||
break;
|
||||
case MOUSE_MOVED:
|
||||
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));
|
||||
}
|
||||
|
||||
private void refreshStatusText() {
|
||||
private void refreshStatusText() {
|
||||
String statusText = this.statusMessage;
|
||||
if (componentSlot == null) {
|
||||
if (componentNamesUnderCursor != null && !componentNamesUnderCursor.isEmpty()) {
|
||||
@@ -534,6 +544,11 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
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;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user