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.
- Better formatting of minimized expressions.
- 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 N and P channel FETs and some CMOS examples, including a 16 bit SRAM
- 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.Point2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@ -568,23 +567,15 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
@Override
public void actionPerformed(ActionEvent e) {
attributeDialog.dispose();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Main(CircuitComponent.this,
((LibrarySelector.ElementTypeDescriptionCustom) elementType).getFile(),
new SavedListener() {
@Override
public void saved(File filename) {
if (parentsSavedListener != null)
parentsSavedListener.saved(filename);
library.removeElement(filename);
circuit.clearState();
hasChanged();
}
}).setVisible(true);
}
});
SwingUtilities.invokeLater(() -> new Main(CircuitComponent.this,
((LibrarySelector.ElementTypeDescriptionCustom) elementType).getFile(),
filename -> {
if (parentsSavedListener != null)
parentsSavedListener.saved(filename);
library.removeElement(filename);
circuit.clearState();
hasChanged();
}).setVisible(true));
}
}.setToolTip(Lang.get("attr_openCircuit_tt")));
}
@ -724,7 +715,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
if (list.size() == 1)
vp = list.get(0);
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();
}
return vp;
@ -738,20 +729,19 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
VisualElement vp = getVisualElement(pos, true);
if (vp != null)
editAttributes(vp, e);
else {
Wire wire = circuit.getWireAt(pos, SIZE2);
if (wire != null)
mouseMoveWire.activate(wire, pos);
}
} else if (e.getButton() == MouseEvent.BUTTON1) {
VisualElement vp = getVisualElement(pos, false);
if (vp != null) {
if (circuit.isPinPos(raster(pos), vp))
if (circuit.isPinPos(raster(pos), vp) && !e.isControlDown())
mouseWire.activate(pos);
else
mouseMoveElement.activate(vp, pos);
} 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);
}
}
@ -909,7 +899,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
super.activate();
this.wire = wire;
this.pos = raster(pos);
this.initialPos=this.pos;
this.initialPos = this.pos;
deleteAction.setActive(true);
removeHighLighted();
hasChanged();

View File

@ -172,12 +172,12 @@
<faq>
<question>Wie kann ich eine Leitung verschieben?</question>
<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>
<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.
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>
<question>Wie kann ich ein Element verschieben und dabei alle angeschlossenen Leitungen mitnehmen?</question>

View File

@ -164,12 +164,12 @@
<faq>
<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.
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>
<question>How to delete a wire?</question>
<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>
<question>How to move a component including all the connected wires?</question>