mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-25 22:18:48 -04:00
improved undo/redo tool tips
This commit is contained in:
parent
3ae68a36d5
commit
2f2a5d865e
@ -46,11 +46,16 @@ public abstract class ModificationOfVisualElement implements Modification {
|
||||
* @param ve the element
|
||||
* @return translated name
|
||||
*/
|
||||
public static String getTranslatedName(VisualElement ve) {
|
||||
String s = Lang.get("elem_" + ve.getElementName());
|
||||
public static String getToolTipName(VisualElement ve) {
|
||||
String s = Lang.getNull("elem_" + ve.getElementName());
|
||||
if (s == null) {
|
||||
s = ve.getElementName();
|
||||
if (s.endsWith(".dig"))
|
||||
s = s.substring(0, s.length() - 4);
|
||||
}
|
||||
String l = ve.getElementAttributes().get(Keys.LABEL);
|
||||
if (l.length() > 0)
|
||||
s += " ('" + l + "')";
|
||||
s += " (" + l + ")";
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ModifyAttribute<VALUE> extends ModificationOfVisualElement {
|
||||
* @param value the new value
|
||||
*/
|
||||
public ModifyAttribute(VisualElement ve, Key<VALUE> key, VALUE value) {
|
||||
super(ve, Lang.get("mod_setKey_N0_in_element_N1", key.getName(), getTranslatedName(ve)));
|
||||
super(ve, Lang.get("mod_setKey_N0_in_element_N1", key.getName(), getToolTipName(ve)));
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class ModifyAttributes extends ModificationOfVisualElement {
|
||||
* @param modified the new attributes
|
||||
*/
|
||||
public ModifyAttributes(VisualElement ve, ElementAttributes modified) {
|
||||
super(ve, Lang.get("mod_setAttributes"));
|
||||
super(ve, Lang.get("mod_setAttributesIn_N", getToolTipName(ve)));
|
||||
attributes = modified;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class ModifyDeleteElement extends ModificationOfVisualElement {
|
||||
* @param initialPos its initial position
|
||||
*/
|
||||
public ModifyDeleteElement(VisualElement ve, Vector initialPos) {
|
||||
super(ve, initialPos, Lang.get("mod_deletedElement_N", getTranslatedName(ve)));
|
||||
super(ve, initialPos, Lang.get("mod_deletedElement_N", getToolTipName(ve)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,7 @@ import de.neemann.digital.draw.elements.Circuit;
|
||||
import de.neemann.digital.draw.elements.VisualElement;
|
||||
import de.neemann.digital.lang.Lang;
|
||||
|
||||
import static de.neemann.digital.gui.components.modification.ModificationOfVisualElement.getTranslatedName;
|
||||
import static de.neemann.digital.gui.components.modification.ModificationOfVisualElement.getToolTipName;
|
||||
|
||||
/**
|
||||
* Modifier to insert an element
|
||||
@ -29,6 +29,6 @@ public class ModifyInsertElement implements Modification {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Lang.get("mod_insertedElement_N", getTranslatedName(element));
|
||||
return Lang.get("mod_insertedElement_N", getToolTipName(element));
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class ModifyMoveAndRotElement extends ModificationOfVisualElement {
|
||||
* @param initialPos its initial position
|
||||
*/
|
||||
public ModifyMoveAndRotElement(VisualElement ve, Vector initialPos) {
|
||||
super(ve, initialPos, Lang.get("mod_movedOrRotatedElement_N", getTranslatedName(ve)));
|
||||
super(ve, initialPos, Lang.get("mod_movedOrRotatedElement_N", getToolTipName(ve)));
|
||||
pos = ve.getPos();
|
||||
rotation = ve.getRotate();
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
||||
<string name="mod_insertWire">Leitung eingefügt.</string>
|
||||
<string name="mod_insertCopied">Aus Zwischenablage eingefügt.</string>
|
||||
<string name="mod_setKey_N0_in_element_N1">Wert ''{0}'' in Element ''{1}'' verändert.</string>
|
||||
<string name="mod_setAttributes">Attribute in Element verändert.</string>
|
||||
<string name="mod_setAttributesIn_N">Attribute in Element ''{0}'' verändert.</string>
|
||||
<string name="mod_wireDeleted">Leitung gelöscht.</string>
|
||||
<string name="mod_movedOrRotatedElement_N">Element ''{0}'' verschoben oder rotiert.</string>
|
||||
<string name="mod_movedWire">Leitung verschoben.</string>
|
||||
|
@ -638,7 +638,7 @@ The names of the variables may not be unique.</string>
|
||||
<string name="mod_insertWire">Inserted wire.</string>
|
||||
<string name="mod_insertCopied">Insert from clipboard.</string>
|
||||
<string name="mod_setKey_N0_in_element_N1">Value ''{0}'' in component ''{1}'' modified.</string>
|
||||
<string name="mod_setAttributes">Attributes of component modified.</string>
|
||||
<string name="mod_setAttributesIn_N">Attributes of component ''{0}'' modified.</string>
|
||||
<string name="mod_wireDeleted">Wire deleted.</string>
|
||||
<string name="mod_movedOrRotatedElement_N">Component ''{0}'' moved or rotated.</string>
|
||||
<string name="mod_movedWire">Wire moved.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user