mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Added "Find" functionality that locates and selects component(s)
matching the search text
This commit is contained in:
@@ -102,5 +102,9 @@ public enum EventType {
|
||||
/**
|
||||
* Called to update the status message. New status message is passed as a first parameter.
|
||||
*/
|
||||
STATUS_MESSAGE_CHANGED;
|
||||
STATUS_MESSAGE_CHANGED,
|
||||
/**
|
||||
* Signals the listeners to scroll to selection.
|
||||
*/
|
||||
SCROLL_TO;
|
||||
}
|
||||
|
||||
@@ -113,5 +113,12 @@ public interface ISelectionProcessor {
|
||||
* @param yOffset
|
||||
* @param includeStuckComponents
|
||||
*/
|
||||
void nudgeSelection(Size xOffset, Size yOffset, boolean includeStuckComponents);
|
||||
void nudgeSelection(Size xOffset, Size yOffset, boolean includeStuckComponents);
|
||||
|
||||
/**
|
||||
* Selects components that match the criteria.
|
||||
*
|
||||
* @param criteria
|
||||
*/
|
||||
void selectMatching(String criteria);
|
||||
}
|
||||
|
||||
@@ -32,5 +32,25 @@ public enum Orientation {
|
||||
} else {
|
||||
return name().replace("_", "") + " degrees clockwise";
|
||||
}
|
||||
}
|
||||
|
||||
public double toDegrees() {
|
||||
switch (this) {
|
||||
case DEFAULT:
|
||||
return 0;
|
||||
case _180:
|
||||
return 180;
|
||||
case _270:
|
||||
return 270;
|
||||
case _90:
|
||||
return 90;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double toRadians() {
|
||||
return Math.toRadians(toDegrees());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1003,6 +1003,19 @@ public class Presenter implements IPlugInPort {
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
drawingManager.clearContinuityArea();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectMatching(String criteria) {
|
||||
Set<IDIYComponent<?>> matching = new HashSet<IDIYComponent<?>>();
|
||||
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
||||
if ((c.getName() != null && c.getName().toLowerCase().matches(criteria.toLowerCase())) ||
|
||||
(c.getValueForDisplay() != null && c.getValueForDisplay().toLowerCase().matches(criteria.toLowerCase())))
|
||||
matching.add(c);
|
||||
}
|
||||
updateSelection(matching);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
messageDispatcher.dispatchMessage(EventType.SCROLL_TO, getSelectionBounds(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VersionNumber getCurrentVersionNumber() {
|
||||
@@ -1924,7 +1937,7 @@ public class Presenter implements IPlugInPort {
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.STICKY_POINTS_KEY, true)) {
|
||||
includeStuckComponents(controlPointMap);
|
||||
}
|
||||
messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED, selectedComponents, controlPointMap.keySet());
|
||||
messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED, selectedComponents, controlPointMap.keySet());
|
||||
}
|
||||
|
||||
private static boolean useNetlistForExpandSelection = false;
|
||||
|
||||
@@ -2934,6 +2934,10 @@
|
||||
<releaseDate>2020-04-09 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added "Find" functionality that locates and selects component(s) matching the search text</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added "Tag Strip" component for point-to-point layouts</description>
|
||||
|
||||
Reference in New Issue
Block a user