Select all within a layer

This commit is contained in:
bancika
2013-04-30 14:12:34 +00:00
parent 0a490d148a
commit f7f669bff3
5 changed files with 45 additions and 10 deletions
@@ -340,7 +340,7 @@ public class ActionFactory {
.getCurrentProject().getComponents());
// Cleanup components in the temp presenter, don't need
// them anymore
presenter.selectAll();
presenter.selectAll(0);
presenter.deleteSelectedComponents();
return null;
}
@@ -776,7 +776,7 @@ public class ActionFactory {
@Override
public void actionPerformed(ActionEvent e) {
LOG.info("Select All triggered");
plugInPort.selectAll();
plugInPort.selectAll(0);
}
}
@@ -18,16 +18,18 @@ import org.diylc.swing.ISwingUI;
public class LayersMenuPlugin implements IPlugIn {
private static final String LOCK_LAYERS_TITLE = "Lock Layers";
private static final String LOCK_LAYERS_TITLE = "Layers";
private IPlugInPort plugInPort;
private Map<Layer, Action> lockActionMap;
private Map<Integer, Action> selectAllActionMap;
public LayersMenuPlugin(ISwingUI swingUI) {
lockActionMap = new HashMap<Layer, Action>();
selectAllActionMap = new HashMap<Integer, Action>();
for (Layer layer : Layer.values()) {
final int zOrder = layer.getZOrder();
AbstractAction action = new AbstractAction(layer.getTitle()) {
AbstractAction lockAction = new AbstractAction("Lock") {
private static final long serialVersionUID = 1L;
@@ -35,11 +37,27 @@ public class LayersMenuPlugin implements IPlugIn {
public void actionPerformed(ActionEvent e) {
LayersMenuPlugin.this.plugInPort.setLayerLocked(zOrder,
(Boolean) getValue(Action.SELECTED_KEY));
selectAllActionMap.get(zOrder).setEnabled(
!(Boolean) getValue(Action.SELECTED_KEY));
}
};
action.putValue(IView.CHECK_BOX_MENU_ITEM, true);
lockActionMap.put(layer, action);
swingUI.injectMenuAction(action, LOCK_LAYERS_TITLE);
lockAction.putValue(IView.CHECK_BOX_MENU_ITEM, true);
lockActionMap.put(layer, lockAction);
AbstractAction selectAllAction = new AbstractAction("Select All") {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
LayersMenuPlugin.this.plugInPort.selectAll(zOrder);
}
};
selectAllActionMap.put(zOrder, selectAllAction);
swingUI.injectSubmenu(layer.title, null, LOCK_LAYERS_TITLE);
swingUI.injectMenuAction(lockAction, layer.title);
swingUI.injectMenuAction(selectAllAction, layer.title);
}
}
@@ -66,9 +84,10 @@ public class LayersMenuPlugin implements IPlugIn {
}
static enum Layer {
CHASSIS("Chassis", IDIYComponent.CHASSIS), BOARD("Board", IDIYComponent.BOARD), TRACE(
"Trace", IDIYComponent.TRACE), COMPONENT("Component", IDIYComponent.COMPONENT), TEXT(
"Text", IDIYComponent.TEXT);
CHASSIS("Chassis", IDIYComponent.CHASSIS), BOARD("Board",
IDIYComponent.BOARD), TRACE("Trace", IDIYComponent.TRACE), COMPONENT(
"Component", IDIYComponent.COMPONENT), TEXT("Text",
IDIYComponent.TEXT);
String title;
int zOrder;
@@ -1233,5 +1233,21 @@
</changes>
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
</org.diylc.appframework.update.Version>
<org.diylc.appframework.update.Version>
<versionNumber>
<major>3</major>
<minor>28</minor>
<build>0</build>
</versionNumber>
<releaseDate>2013-04-30 20:00:00.000 CET</releaseDate>
<name></name>
<changes>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Select all within a layer</description>
</org.diylc.appframework.update.Change>
</changes>
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
</org.diylc.appframework.update.Version>
</a>
</java.util.Arrays_-ArrayList>