Made selection of wires more consistent.

This commit is contained in:
hneemann 2017-03-24 21:12:43 +01:00
parent 05f88595c7
commit 84b16602de
4 changed files with 22 additions and 32 deletions

View File

@ -4,7 +4,7 @@ planned as v0.10
- User can select the expressions representation format in the settings dialog. - User can select the expressions representation format in the settings dialog.
- Better formatting of minimized expressions. - Better formatting of minimized expressions.
- Mouse actions can be canceled by the ESC key. - Mouse actions can be canceled by the ESC key.
- With the right mouse button you can now select and move/delete wires. - With CTRL + mouse button you can now select and move/delete wires.
- Added a real bidirectional switch and a relay. - Added a real bidirectional switch and a relay.
- Added N and P channel FETs and some CMOS examples, including a 16 bit SRAM - Added N and P channel FETs and some CMOS examples, including a 16 bit SRAM
- Improved and documented the file import strategy. - Improved and documented the file import strategy.

View File

@ -36,7 +36,6 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException; import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
@ -568,23 +567,15 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
attributeDialog.dispose(); attributeDialog.dispose();
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(() -> new Main(CircuitComponent.this,
@Override
public void run() {
new Main(CircuitComponent.this,
((LibrarySelector.ElementTypeDescriptionCustom) elementType).getFile(), ((LibrarySelector.ElementTypeDescriptionCustom) elementType).getFile(),
new SavedListener() { filename -> {
@Override
public void saved(File filename) {
if (parentsSavedListener != null) if (parentsSavedListener != null)
parentsSavedListener.saved(filename); parentsSavedListener.saved(filename);
library.removeElement(filename); library.removeElement(filename);
circuit.clearState(); circuit.clearState();
hasChanged(); hasChanged();
} }).setVisible(true));
}).setVisible(true);
}
});
} }
}.setToolTip(Lang.get("attr_openCircuit_tt"))); }.setToolTip(Lang.get("attr_openCircuit_tt")));
} }
@ -724,7 +715,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
if (list.size() == 1) if (list.size() == 1)
vp = list.get(0); vp = list.get(0);
else if (list.size() > 1) { else if (list.size() > 1) {
ItemPicker<VisualElement> picker = new ItemPicker<VisualElement>(CircuitComponent.this, list); ItemPicker<VisualElement> picker = new ItemPicker<>(CircuitComponent.this, list);
vp = picker.select(); vp = picker.select();
} }
return vp; return vp;
@ -738,20 +729,19 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
VisualElement vp = getVisualElement(pos, true); VisualElement vp = getVisualElement(pos, true);
if (vp != null) if (vp != null)
editAttributes(vp, e); editAttributes(vp, e);
else {
Wire wire = circuit.getWireAt(pos, SIZE2);
if (wire != null)
mouseMoveWire.activate(wire, pos);
}
} else if (e.getButton() == MouseEvent.BUTTON1) { } else if (e.getButton() == MouseEvent.BUTTON1) {
VisualElement vp = getVisualElement(pos, false); VisualElement vp = getVisualElement(pos, false);
if (vp != null) { if (vp != null) {
if (circuit.isPinPos(raster(pos), vp)) if (circuit.isPinPos(raster(pos), vp) && !e.isControlDown())
mouseWire.activate(pos); mouseWire.activate(pos);
else else
mouseMoveElement.activate(vp, pos); mouseMoveElement.activate(vp, pos);
} else { } else {
if (!focusWasLost) if (e.isControlDown()) {
Wire wire = circuit.getWireAt(pos, SIZE2);
if (wire != null)
mouseMoveWire.activate(wire, pos);
} else if (!focusWasLost)
mouseWire.activate(pos); mouseWire.activate(pos);
} }
} }

View File

@ -172,12 +172,12 @@
<faq> <faq>
<question>Wie kann ich eine Leitung verschieben?</question> <question>Wie kann ich eine Leitung verschieben?</question>
<answer>Mit der Rechteckauswahl einen Endpunkt auswählen und dann mit der Maus verschieben. <answer>Mit der Rechteckauswahl einen Endpunkt auswählen und dann mit der Maus verschieben.
Alternativ kann eine einzelne Leitung mit der rechten Maustaste selektiert werden.</answer> Alternativ kann eine einzelne Leitung mit STRG+Mausklick selektiert werden.</answer>
</faq> </faq>
<faq> <faq>
<question>Wie kann ich eine Leitung löschen?</question> <question>Wie kann ich eine Leitung löschen?</question>
<answer>Mit der Rechteckauswahl einen Endpunkt auswählen und dann <e>Entfernen</e> drücken bzw. auf den Papierkorb klicken. <answer>Mit der Rechteckauswahl einen Endpunkt auswählen und dann <e>Entfernen</e> drücken bzw. auf den Papierkorb klicken.
Alternativ kann eine einzelne Leitung mit der rechten Maustaste selektiert werden.</answer> Alternativ kann eine einzelne Leitung mit STRG+Mausklick selektiert werden.</answer>
</faq> </faq>
<faq> <faq>
<question>Wie kann ich ein Element verschieben und dabei alle angeschlossenen Leitungen mitnehmen?</question> <question>Wie kann ich ein Element verschieben und dabei alle angeschlossenen Leitungen mitnehmen?</question>

View File

@ -164,12 +164,12 @@
<faq> <faq>
<question>How to move a wire?</question> <question>How to move a wire?</question>
<answer>Select on of the end points with the rectangular selection. The move this point using the mouse. <answer>Select on of the end points with the rectangular selection. The move this point using the mouse.
You can also select a wire with the right mouse button.</answer> You can also select a wire with CTRL + mouse button.</answer>
</faq> </faq>
<faq> <faq>
<question>How to delete a wire?</question> <question>How to delete a wire?</question>
<answer>Select on of the end points and press <e>DEL</e> or click on the trashcan. <answer>Select on of the end points and press <e>DEL</e> or click on the trashcan.
You can also select a wire with the right mouse button.</answer> You can also select a wire with CTRL + mouse button.</answer>
</faq> </faq>
<faq> <faq>
<question>How to move a component including all the connected wires?</question> <question>How to move a component including all the connected wires?</question>