mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-26 22:41:59 -04:00
resolved merge conflicts
This commit is contained in:
parent
890fde5903
commit
72849cddab
@ -74,9 +74,9 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
private final MouseController mouseRun;
|
private final MouseController mouseRun;
|
||||||
private final MouseControllerInsertCopied mouseInsertList;
|
private final MouseControllerInsertCopied mouseInsertList;
|
||||||
private final Cursor moveCursor;
|
private final Cursor moveCursor;
|
||||||
private final AbstractAction copyAction;
|
private final ToolTipAction copyAction;
|
||||||
private final AbstractAction pasteAction;
|
private final ToolTipAction pasteAction;
|
||||||
private final AbstractAction rotateAction;
|
private final ToolTipAction rotateAction;
|
||||||
private final ToolTipAction undoAction;
|
private final ToolTipAction undoAction;
|
||||||
private final ToolTipAction redoAction;
|
private final ToolTipAction redoAction;
|
||||||
|
|
||||||
@ -109,13 +109,12 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
this.library = library;
|
this.library = library;
|
||||||
highLighted = new HashSet<>();
|
highLighted = new HashSet<>();
|
||||||
|
|
||||||
rotateAction = new AbstractAction(Lang.get("menu_rotate")) {
|
rotateAction = new ToolTipAction(Lang.get("menu_rotate")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
activeMouseController.rotate();
|
activeMouseController.rotate();
|
||||||
}
|
}
|
||||||
};
|
}.setActive(false).setAccelerator(KeyStroke.getKeyStroke("R")).enableAcceleratorIn(this);
|
||||||
rotateAction.setEnabled(false);
|
|
||||||
|
|
||||||
|
|
||||||
copyAction = createCopyAction(shapeFactory);
|
copyAction = createCopyAction(shapeFactory);
|
||||||
@ -142,35 +141,25 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_redo_tt"));
|
}.setToolTip(Lang.get("menu_redo_tt"));
|
||||||
|
|
||||||
Action escapeAction = new AbstractAction() {
|
new ToolTipAction("Escape") {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
activeMouseController.escapePressed();
|
activeMouseController.escapePressed();
|
||||||
}
|
}
|
||||||
};
|
}.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)).enableAcceleratorIn(this);
|
||||||
|
|
||||||
AbstractAction programAction = new AbstractAction(Lang.get("menu_programDiode")) {
|
new ToolTipAction(Lang.get("menu_programDiode")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (activeMouseController instanceof MouseControllerNormal) {
|
if (activeMouseController instanceof MouseControllerNormal) {
|
||||||
programElementAt(getPosVector(lastMousePos.x, lastMousePos.y));
|
programElementAt(getPosVector(lastMousePos.x, lastMousePos.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}.setAccelerator(KeyStroke.getKeyStroke("P")).enableAcceleratorIn(this);
|
||||||
|
|
||||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), ESC_ACTION);
|
|
||||||
getActionMap().put(ESC_ACTION, escapeAction);
|
|
||||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DEL_ACTION);
|
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), DEL_ACTION);
|
||||||
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), DEL_ACTION);
|
getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), DEL_ACTION);
|
||||||
getActionMap().put(DEL_ACTION, deleteAction);
|
getActionMap().put(DEL_ACTION, deleteAction);
|
||||||
getInputMap().put(KeyStroke.getKeyStroke('C', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "myCopy");
|
|
||||||
getActionMap().put("myCopy", copyAction);
|
|
||||||
getInputMap().put(KeyStroke.getKeyStroke('V', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "myPaste");
|
|
||||||
getActionMap().put("myPaste", pasteAction);
|
|
||||||
getInputMap().put(KeyStroke.getKeyStroke("R"), "myRotate");
|
|
||||||
getActionMap().put("myRotate", rotateAction);
|
|
||||||
getInputMap().put(KeyStroke.getKeyStroke("P"), "myProgram");
|
|
||||||
getActionMap().put("myProgram", programAction);
|
|
||||||
|
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
|
|
||||||
@ -221,8 +210,8 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
setToolTipText("");
|
setToolTipText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private AbstractAction createPasteAction(ShapeFactory shapeFactory) {
|
private ToolTipAction createPasteAction(ShapeFactory shapeFactory) {
|
||||||
return new AbstractAction(Lang.get("menu_paste")) {
|
return new ToolTipAction(Lang.get("menu_paste")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (!isLocked()) {
|
if (!isLocked()) {
|
||||||
@ -243,11 +232,11 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}.setAcceleratorCTRLplus('V').enableAcceleratorIn(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AbstractAction createCopyAction(ShapeFactory shapeFactory) {
|
private ToolTipAction createCopyAction(ShapeFactory shapeFactory) {
|
||||||
AbstractAction copyAction = new AbstractAction(Lang.get("menu_copy")) {
|
return new ToolTipAction(Lang.get("menu_copy")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
ArrayList<Movable> elements = null;
|
ArrayList<Movable> elements = null;
|
||||||
@ -265,9 +254,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
activeMouseController.escapePressed();
|
activeMouseController.escapePressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}.setActive(false).setAcceleratorCTRLplus('C').enableAcceleratorIn(this);
|
||||||
copyAction.setEnabled(false);
|
|
||||||
return copyAction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void programElementAt(Vector pos) {
|
private void programElementAt(Vector pos) {
|
||||||
@ -405,21 +392,21 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
/**
|
/**
|
||||||
* @return the copy action
|
* @return the copy action
|
||||||
*/
|
*/
|
||||||
public AbstractAction getCopyAction() {
|
public ToolTipAction getCopyAction() {
|
||||||
return copyAction;
|
return copyAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the paste action
|
* @return the paste action
|
||||||
*/
|
*/
|
||||||
public AbstractAction getPasteAction() {
|
public ToolTipAction getPasteAction() {
|
||||||
return pasteAction;
|
return pasteAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the rotate action
|
* @return the rotate action
|
||||||
*/
|
*/
|
||||||
public AbstractAction getRotateAction() {
|
public ToolTipAction getRotateAction() {
|
||||||
return rotateAction;
|
return rotateAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class TestExamples extends TestCase {
|
|||||||
*/
|
*/
|
||||||
public void testDistExamples() throws Exception {
|
public void testDistExamples() throws Exception {
|
||||||
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig");
|
||||||
assertEquals(175, new FileScanner(this::check).scan(examples));
|
assertEquals(176, new FileScanner(this::check).scan(examples));
|
||||||
assertEquals(78, testCasesInFiles);
|
assertEquals(78, testCasesInFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user