mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
consolidated menus
This commit is contained in:
@@ -6,6 +6,8 @@ public interface IKeyProcessor {
|
|||||||
public static final int VK_UP = 0x26;
|
public static final int VK_UP = 0x26;
|
||||||
public static final int VK_RIGHT = 0x27;
|
public static final int VK_RIGHT = 0x27;
|
||||||
public static final int VK_DOWN = 0x28;
|
public static final int VK_DOWN = 0x28;
|
||||||
|
public static final int VK_H = 0x48;
|
||||||
|
public static final int VK_V = 0x56;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the presenter that a key hes been pressed on the canvas.
|
* Notifies the presenter that a key hes been pressed on the canvas.
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@@ -575,7 +575,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
public boolean keyPressed(int key, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||||
if (key != VK_DOWN && key != VK_LEFT && key != VK_UP && key != VK_RIGHT) {
|
if (key != VK_DOWN && key != VK_LEFT && key != VK_UP && key != VK_RIGHT && key != IKeyProcessor.VK_H
|
||||||
|
&& key != IKeyProcessor.VK_V) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LOG.debug(String.format("keyPressed(%s, %s, %s, %s)", key, ctrlDown, shiftDown, altDown));
|
LOG.debug(String.format("keyPressed(%s, %s, %s, %s)", key, ctrlDown, shiftDown, altDown));
|
||||||
@@ -609,6 +610,12 @@ public class Presenter implements IPlugInPort {
|
|||||||
} else if (key == IKeyProcessor.VK_LEFT) {
|
} else if (key == IKeyProcessor.VK_LEFT) {
|
||||||
oldProject = currentProject.clone();
|
oldProject = currentProject.clone();
|
||||||
rotateComponents(this.selectedComponents, -1, snapToGrid);
|
rotateComponents(this.selectedComponents, -1, snapToGrid);
|
||||||
|
} else if (key == IKeyProcessor.VK_H) {
|
||||||
|
oldProject = currentProject.clone();
|
||||||
|
mirrorSelection(ISelectionProcessor.HORIZONTAL);
|
||||||
|
} else if (key == IKeyProcessor.VK_V) {
|
||||||
|
oldProject = currentProject.clone();
|
||||||
|
mirrorSelection(ISelectionProcessor.VERTICAL);
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, currentProject.clone(),
|
||||||
@@ -1898,7 +1905,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
ComponentType selectedType = null;
|
ComponentType selectedType = null;
|
||||||
Iterator<IDIYComponent<?>> iterator = this.selectedComponents.iterator();
|
Iterator<IDIYComponent<?>> iterator = this.selectedComponents.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ComponentType type = ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) iterator.next().getClass());
|
ComponentType type =
|
||||||
|
ComponentProcessor.getInstance().extractComponentTypeFrom(
|
||||||
|
(Class<? extends IDIYComponent<?>>) iterator.next().getClass());
|
||||||
if (selectedType == null)
|
if (selectedType == null)
|
||||||
selectedType = type;
|
selectedType = type;
|
||||||
else if (selectedType.getInstanceClass() != type.getInstanceClass())
|
else if (selectedType.getInstanceClass() != type.getInstanceClass())
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -37,7 +37,7 @@ public enum IconLoader {
|
|||||||
"nav_right_blue.png"), MissingImage("missing_image.png"), CloudBg("cloud_bg.png"), CloudBig("cloud_big.png"), CloudWait(
|
"nav_right_blue.png"), MissingImage("missing_image.png"), CloudBg("cloud_bg.png"), CloudBig("cloud_big.png"), CloudWait(
|
||||||
"cloud_wait.png"), Spinning("spinning.gif"), Megaphone("megaphone.png"), Download("download.png"), Eye("eye.png"), Messages(
|
"cloud_wait.png"), Spinning("spinning.gif"), Megaphone("megaphone.png"), Download("download.png"), Eye("eye.png"), Messages(
|
||||||
"messages.png"), SearchBox("search-box.png"), Screwdriver("screwdriver.png"), Hammer("hammer.png"), FlipHorizontal("flip_horizontal.png"),
|
"messages.png"), SearchBox("search-box.png"), Screwdriver("screwdriver.png"), Hammer("hammer.png"), FlipHorizontal("flip_horizontal.png"),
|
||||||
FlipVertical("flip_vertical.png");
|
FlipVertical("flip_vertical.png"), MagicWand("magic_wand.png");
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 902 B |
@@ -771,7 +771,7 @@ public class ActionFactory {
|
|||||||
public EditProjectAction(IPlugInPort plugInPort) {
|
public EditProjectAction(IPlugInPort plugInPort) {
|
||||||
super();
|
super();
|
||||||
this.plugInPort = plugInPort;
|
this.plugInPort = plugInPort;
|
||||||
putValue(AbstractAction.NAME, "Edit Project");
|
putValue(AbstractAction.NAME, "Edit Project Settings");
|
||||||
putValue(AbstractAction.SMALL_ICON, IconLoader.DocumentEdit.getIcon());
|
putValue(AbstractAction.SMALL_ICON, IconLoader.DocumentEdit.getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -941,9 +941,11 @@ public class ActionFactory {
|
|||||||
if (direction == ISelectionProcessor.HORIZONTAL) {
|
if (direction == ISelectionProcessor.HORIZONTAL) {
|
||||||
putValue(AbstractAction.NAME, "Mirror Horizontally");
|
putValue(AbstractAction.NAME, "Mirror Horizontally");
|
||||||
putValue(AbstractAction.SMALL_ICON, IconLoader.FlipHorizontal.getIcon());
|
putValue(AbstractAction.SMALL_ICON, IconLoader.FlipHorizontal.getIcon());
|
||||||
|
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK));
|
||||||
} else {
|
} else {
|
||||||
putValue(AbstractAction.NAME, "Mirror Vertically");
|
putValue(AbstractAction.NAME, "Mirror Vertically");
|
||||||
putValue(AbstractAction.SMALL_ICON, IconLoader.FlipVertical.getIcon());
|
putValue(AbstractAction.SMALL_ICON, IconLoader.FlipVertical.getIcon());
|
||||||
|
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.ALT_MASK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1055,8 +1057,10 @@ public class ActionFactory {
|
|||||||
putValue(AbstractAction.NAME, browserType);
|
putValue(AbstractAction.NAME, browserType);
|
||||||
putValue(IView.RADIO_BUTTON_GROUP_KEY, "componentBrowser");
|
putValue(IView.RADIO_BUTTON_GROUP_KEY, "componentBrowser");
|
||||||
|
|
||||||
putValue(AbstractAction.SELECTED_KEY,
|
putValue(
|
||||||
browserType.equals(ConfigurationManager.getInstance().readString(ConfigPlugin.COMPONENT_BROWSER, ConfigPlugin.SEARCHABLE_TREE)));
|
AbstractAction.SELECTED_KEY,
|
||||||
|
browserType.equals(ConfigurationManager.getInstance().readString(ConfigPlugin.COMPONENT_BROWSER,
|
||||||
|
ConfigPlugin.SEARCHABLE_TREE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -138,6 +138,10 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
getUngroupAction().setEnabled(enabled);
|
getUngroupAction().setEnabled(enabled);
|
||||||
getSendToBackAction().setEnabled(enabled);
|
getSendToBackAction().setEnabled(enabled);
|
||||||
getBringToFrontAction().setEnabled(enabled);
|
getBringToFrontAction().setEnabled(enabled);
|
||||||
|
getRotateClockwiseAction().setEnabled(enabled);
|
||||||
|
getRotateCounterclockwiseAction().setEnabled(enabled);
|
||||||
|
getMirrorHorizontallyAction().setEnabled(enabled);
|
||||||
|
getMirrorVerticallyAction().setEnabled(enabled);
|
||||||
|
|
||||||
getSaveAsTemplateAction().setEnabled(plugInPort.getSelectedComponents().size() == 1);
|
getSaveAsTemplateAction().setEnabled(plugInPort.getSelectedComponents().size() == 1);
|
||||||
|
|
||||||
@@ -280,14 +284,18 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
public JMenu getTransformMenu() {
|
public JMenu getTransformMenu() {
|
||||||
if (transformMenu == null) {
|
if (transformMenu == null) {
|
||||||
transformMenu = new JMenu("Transform Selection");
|
transformMenu = new JMenu("Transform Selection");
|
||||||
|
transformMenu.setIcon(IconLoader.MagicWand.getIcon());
|
||||||
transformMenu.add(getRotateClockwiseAction());
|
transformMenu.add(getRotateClockwiseAction());
|
||||||
transformMenu.add(getRotateCounterclockwiseAction());
|
transformMenu.add(getRotateCounterclockwiseAction());
|
||||||
|
transformMenu.addSeparator();
|
||||||
transformMenu.add(getMirrorHorizontallyAction());
|
transformMenu.add(getMirrorHorizontallyAction());
|
||||||
transformMenu.add(getMirrorVerticallyAction());
|
transformMenu.add(getMirrorVerticallyAction());
|
||||||
transformMenu.add(getGroupAction());
|
transformMenu.addSeparator();
|
||||||
transformMenu.add(getUngroupAction());
|
|
||||||
transformMenu.add(getSendToBackAction());
|
transformMenu.add(getSendToBackAction());
|
||||||
transformMenu.add(getBringToFrontAction());
|
transformMenu.add(getBringToFrontAction());
|
||||||
|
transformMenu.addSeparator();
|
||||||
|
transformMenu.add(getGroupAction());
|
||||||
|
transformMenu.add(getUngroupAction());
|
||||||
}
|
}
|
||||||
return transformMenu;
|
return transformMenu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.diylc.appframework.undo.UndoHandler;
|
|||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.common.ISelectionProcessor;
|
||||||
import org.diylc.core.ExpansionMode;
|
import org.diylc.core.ExpansionMode;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.images.IconLoader;
|
import org.diylc.images.IconLoader;
|
||||||
@@ -22,6 +23,7 @@ import org.diylc.swing.ISwingUI;
|
|||||||
public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
||||||
|
|
||||||
private static final String EDIT_TITLE = "Edit";
|
private static final String EDIT_TITLE = "Edit";
|
||||||
|
private static final String TRANSFORM_TITLE = "Transform Selection";
|
||||||
private static final String RENUMBER_TITLE = "Renumber Selection";
|
private static final String RENUMBER_TITLE = "Renumber Selection";
|
||||||
private static final String EXPAND_TITLE = "Expand Selection";
|
private static final String EXPAND_TITLE = "Expand Selection";
|
||||||
|
|
||||||
@@ -47,6 +49,8 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
private ActionFactory.SaveAsTemplateAction saveAsTemplateAction;
|
private ActionFactory.SaveAsTemplateAction saveAsTemplateAction;
|
||||||
private ActionFactory.RotateSelectionAction rotateClockwiseAction;
|
private ActionFactory.RotateSelectionAction rotateClockwiseAction;
|
||||||
private ActionFactory.RotateSelectionAction rotateCounterClockwiseAction;
|
private ActionFactory.RotateSelectionAction rotateCounterClockwiseAction;
|
||||||
|
private ActionFactory.MirrorSelectionAction mirrorHorizontallyAction;
|
||||||
|
private ActionFactory.MirrorSelectionAction mirrorVerticallyAction;
|
||||||
|
|
||||||
private UndoHandler<Project> undoHandler;
|
private UndoHandler<Project> undoHandler;
|
||||||
|
|
||||||
@@ -198,6 +202,22 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
return rotateCounterClockwiseAction;
|
return rotateCounterClockwiseAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionFactory.MirrorSelectionAction getMirrorHorizontallyAction() {
|
||||||
|
if (mirrorHorizontallyAction == null) {
|
||||||
|
mirrorHorizontallyAction =
|
||||||
|
ActionFactory.getInstance().createMirrorSelectionAction(plugInPort, ISelectionProcessor.HORIZONTAL);
|
||||||
|
}
|
||||||
|
return mirrorHorizontallyAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionFactory.MirrorSelectionAction getMirrorVerticallyAction() {
|
||||||
|
if (mirrorVerticallyAction == null) {
|
||||||
|
mirrorVerticallyAction =
|
||||||
|
ActionFactory.getInstance().createMirrorSelectionAction(plugInPort, ISelectionProcessor.VERTICAL);
|
||||||
|
}
|
||||||
|
return mirrorVerticallyAction;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connect(IPlugInPort plugInPort) {
|
public void connect(IPlugInPort plugInPort) {
|
||||||
this.plugInPort = plugInPort;
|
this.plugInPort = plugInPort;
|
||||||
@@ -214,14 +234,20 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
swingUI.injectMenuAction(actionFactory.createSelectAllAction(plugInPort), EDIT_TITLE);
|
swingUI.injectMenuAction(actionFactory.createSelectAllAction(plugInPort), EDIT_TITLE);
|
||||||
swingUI.injectMenuAction(getEditSelectionAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(getEditSelectionAction(), EDIT_TITLE);
|
||||||
swingUI.injectMenuAction(getDeleteSelectionAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(getDeleteSelectionAction(), EDIT_TITLE);
|
||||||
swingUI.injectMenuAction(getRotateClockwiseAction(), EDIT_TITLE);
|
swingUI.injectSubmenu(TRANSFORM_TITLE, IconLoader.MagicWand.getIcon(), EDIT_TITLE);
|
||||||
swingUI.injectMenuAction(getRotateCounterclockwiseAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(getRotateClockwiseAction(), TRANSFORM_TITLE);
|
||||||
swingUI.injectMenuAction(getSendToBackAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(getRotateCounterclockwiseAction(), TRANSFORM_TITLE);
|
||||||
swingUI.injectMenuAction(getBringToFrontAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(null, TRANSFORM_TITLE);
|
||||||
swingUI.injectMenuAction(getGroupAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(getMirrorHorizontallyAction(), TRANSFORM_TITLE);
|
||||||
swingUI.injectMenuAction(getUngroupAction(), EDIT_TITLE);
|
swingUI.injectMenuAction(getMirrorVerticallyAction(), TRANSFORM_TITLE);
|
||||||
|
swingUI.injectMenuAction(null, TRANSFORM_TITLE);
|
||||||
|
swingUI.injectMenuAction(getSendToBackAction(), TRANSFORM_TITLE);
|
||||||
|
swingUI.injectMenuAction(getBringToFrontAction(), TRANSFORM_TITLE);
|
||||||
|
swingUI.injectMenuAction(null, TRANSFORM_TITLE);
|
||||||
|
swingUI.injectMenuAction(getGroupAction(), TRANSFORM_TITLE);
|
||||||
|
swingUI.injectMenuAction(getUngroupAction(), TRANSFORM_TITLE);
|
||||||
swingUI.injectMenuAction(null, EDIT_TITLE);
|
swingUI.injectMenuAction(null, EDIT_TITLE);
|
||||||
swingUI.injectMenuAction(getSaveAsTemplateAction(), EDIT_TITLE);
|
// swingUI.injectMenuAction(getSaveAsTemplateAction(), EDIT_TITLE);
|
||||||
swingUI.injectSubmenu(RENUMBER_TITLE, IconLoader.Sort.getIcon(), EDIT_TITLE);
|
swingUI.injectSubmenu(RENUMBER_TITLE, IconLoader.Sort.getIcon(), EDIT_TITLE);
|
||||||
swingUI.injectMenuAction(getRenumberXAxisAction(), RENUMBER_TITLE);
|
swingUI.injectMenuAction(getRenumberXAxisAction(), RENUMBER_TITLE);
|
||||||
swingUI.injectMenuAction(getRenumberYAxisAction(), RENUMBER_TITLE);
|
swingUI.injectMenuAction(getRenumberYAxisAction(), RENUMBER_TITLE);
|
||||||
@@ -277,6 +303,8 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
getBringToFrontAction().setEnabled(enabled);
|
getBringToFrontAction().setEnabled(enabled);
|
||||||
getRotateClockwiseAction().setEnabled(enabled);
|
getRotateClockwiseAction().setEnabled(enabled);
|
||||||
getRotateCounterclockwiseAction().setEnabled(enabled);
|
getRotateCounterclockwiseAction().setEnabled(enabled);
|
||||||
|
getMirrorHorizontallyAction().setEnabled(enabled);
|
||||||
|
getMirrorVerticallyAction().setEnabled(enabled);
|
||||||
getSaveAsTemplateAction().setEnabled(enabled);
|
getSaveAsTemplateAction().setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1509,5 +1509,25 @@
|
|||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>3</major>
|
||||||
|
<minor>35</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2016-12-30 20:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Mirror selection horizontally and vertically</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Consolidated context menu items</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
Reference in New Issue
Block a user