mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 07:48:29 -04:00
minor changes, typo
This commit is contained in:
parent
32ba284d8f
commit
7060f47bbf
@ -32,7 +32,7 @@ public class AttributeKey<VALUE> {
|
||||
|
||||
public static final AttributeKey<Boolean> ShowDataTable = new AttributeKey<>("showDataTable", Lang.get("key_showDataTable"), false);
|
||||
public static final AttributeKey<Boolean> ShowDataGraph = new AttributeKey<>("showDataGraph", Lang.get("key_showDataGraph"), false);
|
||||
public static final AttributeKey<Boolean> StartTimer = new AttributeKey<>("startTimer", Lang.get("key_startTimer"), false);
|
||||
public static final AttributeKey<Boolean> StartTimer = new AttributeKey<>("startTimer", Lang.get("key_startClock"), false);
|
||||
|
||||
private final String key;
|
||||
private final VALUE def;
|
||||
|
@ -249,10 +249,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
edit.add(orderMeasurements.createJMenuItem());
|
||||
edit.add(editAttributes.createJMenuItem());
|
||||
|
||||
|
||||
JMenu run = new JMenu(Lang.get("menu_run"));
|
||||
bar.add(run);
|
||||
|
||||
doStep = new ToolTipAction(Lang.get("menu_step"), ICON_STEP) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@ -311,11 +307,13 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave {
|
||||
}
|
||||
}.setToolTip(Lang.get("menu_editRunAttributes_tt"));
|
||||
|
||||
JMenu run = new JMenu(Lang.get("menu_run"));
|
||||
bar.add(run);
|
||||
run.add(editRunAttributes.createJMenuItem());
|
||||
run.add(runModelAction.createJMenuItem());
|
||||
run.add(runModelMicroAction.createJMenuItem());
|
||||
run.add(doStep.createJMenuItem());
|
||||
run.add(runToBreak.createJMenuItem());
|
||||
run.add(editRunAttributes.createJMenuItem());
|
||||
doStep.setEnabled(false);
|
||||
|
||||
JToolBar toolBar = new JToolBar();
|
||||
|
@ -198,6 +198,65 @@ public class CircuitComponent extends JComponent {
|
||||
setModeAndReset(Mode.part);
|
||||
}
|
||||
|
||||
private boolean editAttributes(MouseEvent e) {
|
||||
VisualElement vp = circuit.getElementAt(getPosVector(e));
|
||||
if (vp != null) {
|
||||
String name = vp.getElementName();
|
||||
ElementTypeDescription elementType = library.getElementType(name);
|
||||
if (elementType instanceof LibrarySelector.ElementTypeDescriptionCustom) {
|
||||
new Main(this, ((LibrarySelector.ElementTypeDescriptionCustom) elementType).getFile(), new SavedListener() {
|
||||
@Override
|
||||
public void saved(File filename) {
|
||||
library.removeElement(filename.getName());
|
||||
circuit.clearState();
|
||||
repaint();
|
||||
}
|
||||
}).setVisible(true);
|
||||
} else {
|
||||
ArrayList<AttributeKey> list = elementType.getAttributeList();
|
||||
if (list.size() > 0) {
|
||||
Point p = new Point(e.getX(), e.getY());
|
||||
SwingUtilities.convertPointToScreen(p, CircuitComponent.this);
|
||||
if (new AttributeDialog(this, p, list, vp.getElementAttributes()).showDialog()) {
|
||||
circuit.modified();
|
||||
repaint();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class DelAction extends ToolTipAction {
|
||||
|
||||
DelAction() {
|
||||
super(Lang.get("menu_delete"), ICON_DELETE);
|
||||
setToolTip(Lang.get("menu_delete_tt"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (listener instanceof SelectMouseListener) {
|
||||
SelectMouseListener mml = (SelectMouseListener) listener;
|
||||
if (mml.corner1 != null && mml.corner2 != null) {
|
||||
circuit.delete(Vector.min(mml.corner1, mml.corner2), Vector.max(mml.corner1, mml.corner2));
|
||||
mml.reset();
|
||||
repaint();
|
||||
}
|
||||
} else if (listener instanceof PartMouseListener) {
|
||||
PartMouseListener pml = (PartMouseListener) listener;
|
||||
if (!pml.insert) {
|
||||
circuit.delete(pml.partToInsert);
|
||||
}
|
||||
pml.partToInsert = null;
|
||||
deleteAction.setEnabled(false);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum Mode {part, running, select}
|
||||
|
||||
private abstract class Mouse extends MouseAdapter implements MouseMotionListener {
|
||||
@ -318,36 +377,6 @@ public class CircuitComponent extends JComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean editAttributes(MouseEvent e) {
|
||||
VisualElement vp = circuit.getElementAt(getPosVector(e));
|
||||
if (vp != null) {
|
||||
String name = vp.getElementName();
|
||||
ElementTypeDescription elementType = library.getElementType(name);
|
||||
if (elementType instanceof LibrarySelector.ElementTypeDescriptionCustom) {
|
||||
new Main(this, ((LibrarySelector.ElementTypeDescriptionCustom) elementType).getFile(), new SavedListener() {
|
||||
@Override
|
||||
public void saved(File filename) {
|
||||
library.removeElement(filename.getName());
|
||||
circuit.clearState();
|
||||
repaint();
|
||||
}
|
||||
}).setVisible(true);
|
||||
} else {
|
||||
ArrayList<AttributeKey> list = elementType.getAttributeList();
|
||||
if (list.size() > 0) {
|
||||
Point p = new Point(e.getX(), e.getY());
|
||||
SwingUtilities.convertPointToScreen(p, CircuitComponent.this);
|
||||
if (new AttributeDialog(this, p, list, vp.getElementAttributes()).showDialog()) {
|
||||
circuit.modified();
|
||||
repaint();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private enum State {COPY, MOVE}
|
||||
|
||||
private class SelectMouseListener extends Mouse {
|
||||
@ -472,31 +501,4 @@ public class CircuitComponent extends JComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private class DelAction extends ToolTipAction {
|
||||
|
||||
DelAction() {
|
||||
super(Lang.get("menu_delete"), ICON_DELETE);
|
||||
setToolTip(Lang.get("menu_delete_tt"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (listener instanceof SelectMouseListener) {
|
||||
SelectMouseListener mml = (SelectMouseListener) listener;
|
||||
if (mml.corner1 != null && mml.corner2 != null) {
|
||||
circuit.delete(Vector.min(mml.corner1, mml.corner2), Vector.max(mml.corner1, mml.corner2));
|
||||
mml.reset();
|
||||
repaint();
|
||||
}
|
||||
} else if (listener instanceof PartMouseListener) {
|
||||
PartMouseListener pml = (PartMouseListener) listener;
|
||||
if (!pml.insert) {
|
||||
circuit.delete(pml.partToInsert);
|
||||
}
|
||||
pml.partToInsert = null;
|
||||
deleteAction.setEnabled(false);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ key_valueIsProbe=Als Messwert verwenden
|
||||
key_showListing=Zeige Listing an, wenn verf\u00FCgbar
|
||||
key_showDataTable=Zeige Messwertetabelle
|
||||
key_showDataGraph=Zeige Messwertegraph
|
||||
key_startTimer=Starte Timer
|
||||
key_startClock=Starte den Takt
|
||||
|
||||
|
||||
rot_0=0\u00B0
|
||||
|
@ -35,7 +35,7 @@ key_valueIsProbe=Use as measurment value
|
||||
key_showListing=Show list file if available
|
||||
key_showDataTable=Show measurement values
|
||||
key_showDataGraph=Show measurement graph
|
||||
key_startTimer=Start timer
|
||||
key_startClock=Start timer
|
||||
|
||||
rot_0=0\u00B0
|
||||
rot_90=90\u00B0
|
||||
|
Loading…
x
Reference in New Issue
Block a user