mirror of https://github.com/lawrancej/logisim.git
merged original gitignore
Confirmed launch4j in gitignore
This commit is contained in:
commit
af077eceac
|
@ -1,15 +1,22 @@
|
|||
target
|
||||
reports
|
||||
build
|
||||
launch4j
|
||||
build/
|
||||
launch4j/
|
||||
bin/
|
||||
.gradle
|
||||
.project
|
||||
.classpath
|
||||
*sonar*.properties
|
||||
.sonar
|
||||
.settings
|
||||
bin
|
||||
*.class
|
||||
/nbproject/private/
|
||||
.externalToolBuilders
|
||||
*.orig
|
||||
|
||||
# Temp files
|
||||
*~
|
||||
#*#
|
||||
|
||||
# OS specific
|
||||
Thumbs.db
|
||||
|
|
10
README.md
10
README.md
|
@ -1,13 +1,13 @@
|
|||
# README
|
||||
|
||||
Logisim is a circuit simulator, [originally available here](http://ozark.hendrix.edu/~burch/logisim/).
|
||||
Logisim is a circuit simulator, [originally available here](http://www.cburch.com/logisim/).
|
||||
|
||||
## Why this fork of Logisim?
|
||||
Carl Burch, the original author of Logisim, abandoned development in 2011 and moved on to a similar successor project, [Toves](http://www.toves.org/) in 2013, because Logisim's code base is in need of a major overhaul. Rather than start from scratch ([something you should never do](http://www.joelonsoftware.com/articles/fog0000000069.html)), this fork of Logisim picks up where Dr. Burch left off to incrementally improve Logisim.
|
||||
Carl Burch, the original author of Logisim, abandoned development in 2011 and moved on to a similar successor project, [Toves](http://www.toves.org/) in 2013, because Logisim's code base is in need of a major overhaul.
|
||||
Rather than start from scratch ([something you should never do](http://www.joelonsoftware.com/articles/fog0000000069.html)), this fork of Logisim picks up where Dr. Burch left off to incrementally improve Logisim.
|
||||
|
||||
## What's wrong with Logisim?
|
||||
Logisim's code itself has numerous smells. Here's an incomplete list of these:
|
||||
|
||||
* No test suite!
|
||||
* Undocumented packages, classes, methods
|
||||
* Duplicated and dead code
|
||||
|
@ -17,14 +17,14 @@ Logisim's code itself has numerous smells. Here's an incomplete list of these:
|
|||
* Code to draw components is too low-level
|
||||
|
||||
Logisim's user interface has numerous gotchas that need to be addressed. Here's some of the more important issues:
|
||||
|
||||
* The file format is not merge-friendly, making it impossible for students to collaborate on circuits
|
||||
* Unreasonable defaults
|
||||
* Limited interaction styles
|
||||
* Single (graphical) view of circuit
|
||||
|
||||
## What's right with Logisim?
|
||||
It is arguably the best free tool for teaching circuit design, which is why its development must continue.
|
||||
It is arguably the best free/libre and gratis tool for teaching circuit design.
|
||||
That is why its development must continue.
|
||||
|
||||
## Getting started for developers
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@ import java.util.Arrays;
|
|||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import com.cburch.hex.HexEditor;
|
||||
import com.cburch.hex.HexModel;
|
||||
import com.cburch.hex.HexModelListener;
|
||||
|
||||
/**
|
||||
* Tests Hex editor.
|
||||
*
|
||||
|
@ -81,4 +85,4 @@ public class Test {
|
|||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.cburch.logisim.SVG;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
|
||||
import javax.swing.JPanel;
|
|
@ -17,7 +17,6 @@ public class Main extends JPanel implements Runnable {
|
|||
|
||||
private Thread thread;
|
||||
private JFrame frame;
|
||||
private Mouse mouse;
|
||||
|
||||
private boolean running = false;
|
||||
|
||||
|
@ -31,10 +30,8 @@ public class Main extends JPanel implements Runnable {
|
|||
public static void main(String[] args) {
|
||||
Main test = new Main();
|
||||
test.frame = new JFrame(TITLE);
|
||||
test.mouse = new Mouse();
|
||||
test.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
test.frame.getContentPane().add(test);
|
||||
test.frame.addMouseListener(test.mouse);
|
||||
test.frame.pack();
|
||||
test.frame.setFocusable(true);
|
||||
test.frame.setLocationRelativeTo(null);
|
||||
|
@ -86,24 +83,15 @@ public class Main extends JPanel implements Runnable {
|
|||
}
|
||||
stop();
|
||||
}
|
||||
|
||||
private void update() {
|
||||
if(!(mouse.getCoords() == null)) {
|
||||
/*JPanel p = (JPanel) Image.createComponent("andGate.svg", mouse.getCoords());
|
||||
p.setLayout(null);
|
||||
p.setLocation(mouse.getCoords());
|
||||
add(p);
|
||||
frame.pack();*/
|
||||
}
|
||||
|
||||
public void update() {
|
||||
}
|
||||
|
||||
private void render() {
|
||||
Graphics g = getGraphics();
|
||||
public void render() {
|
||||
/*Graphics g = getGraphics();
|
||||
java.awt.Image p;
|
||||
p = Image.createComponent("andGate.svg", new Point(0,0));
|
||||
g.drawImage(
|
||||
Image.createComponent("andGate.svg", new Point(0,0))
|
||||
, 0,0,50,50,null);
|
||||
p = Image.createComponent("/drawing.svg", new Point(0,0));
|
||||
g.drawImage(Image.createComponent("/drawing.svg", new Point(0,0)), 0,0,50,50,null);*/
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,7 @@ public abstract class ModelAction extends Action {
|
|||
|
||||
static String getShapesName(Collection<CanvasObject> coll) {
|
||||
if (coll.size() != 1) {
|
||||
return _("shapeMultiple");
|
||||
return getFromLocale("shapeMultiple");
|
||||
} else {
|
||||
CanvasObject shape = coll.iterator().next();
|
||||
return shape.getDisplayName();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ModelAddAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionAdd", getShapesName(added));
|
||||
return getFromLocale("actionAdd", getShapesName(added));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -57,9 +57,9 @@ public class ModelChangeAttributeAction extends ModelAction {
|
|||
attr = a;
|
||||
}
|
||||
if (a == null) {
|
||||
return _("actionChangeAttributes");
|
||||
return getFromLocale("actionChangeAttributes");
|
||||
} else {
|
||||
return _("actionChangeAttribute", a.getDisplayName());
|
||||
return getFromLocale("actionChangeAttribute", a.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ModelDeleteHandleAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionDeleteHandle");
|
||||
return getFromLocale("actionDeleteHandle");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ModelEditTextAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionEditText");
|
||||
return getFromLocale("actionEditText");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ModelInsertHandleAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionInsertHandle");
|
||||
return getFromLocale("actionInsertHandle");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ModelMoveHandleAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionMoveHandle");
|
||||
return getFromLocale("actionMoveHandle");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ModelRemoveAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionRemove", getShapesName(removed.keySet()));
|
||||
return getFromLocale("actionRemove", getShapesName(removed.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -182,11 +182,11 @@ public class ModelReorderAction extends ModelAction {
|
|||
@Override
|
||||
public String getName() {
|
||||
if (type < 0) {
|
||||
return _("actionRaise", getShapesName(objects));
|
||||
return getFromLocale("actionRaise", getShapesName(objects));
|
||||
} else if (type > 0) {
|
||||
return _("actionLower", getShapesName(objects));
|
||||
return getFromLocale("actionLower", getShapesName(objects));
|
||||
} else {
|
||||
return _("actionReorder", getShapesName(objects));
|
||||
return getFromLocale("actionReorder", getShapesName(objects));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ModelTranslateAction extends ModelAction {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("actionTranslate", getShapesName(moved));
|
||||
return getFromLocale("actionTranslate", getShapesName(moved));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,11 +53,11 @@ class AttrTableSelectionModel extends AttributeSetTableModel
|
|||
if (firstObject == null) {
|
||||
return null;
|
||||
} else if (commonClass == null) {
|
||||
return _("selectionVarious", "" + totalCount);
|
||||
return getFromLocale("selectionVarious", "" + totalCount);
|
||||
} else if (commonCount == 1) {
|
||||
return _("selectionOne", firstObject.getDisplayName());
|
||||
return getFromLocale("selectionOne", firstObject.getDisplayName());
|
||||
} else {
|
||||
return _("selectionMultiple", firstObject.getDisplayName(),
|
||||
return getFromLocale("selectionMultiple", firstObject.getDisplayName(),
|
||||
"" + commonCount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class Curve extends FillableCanvasObject {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("shapeCurve");
|
||||
return getFromLocale("shapeCurve");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,37 +21,37 @@ public class DrawAttr {
|
|||
= new Font("SansSerif", Font.PLAIN, 12);
|
||||
|
||||
public static final AttributeOption ALIGN_LEFT
|
||||
= new AttributeOption(Integer.valueOf(EditableLabel.LEFT), __("alignStart"));
|
||||
= new AttributeOption(Integer.valueOf(EditableLabel.LEFT), getFromLocale("alignStart"));
|
||||
public static final AttributeOption ALIGN_CENTER
|
||||
= new AttributeOption(Integer.valueOf(EditableLabel.CENTER), __("alignMiddle"));
|
||||
= new AttributeOption(Integer.valueOf(EditableLabel.CENTER), getFromLocale("alignMiddle"));
|
||||
public static final AttributeOption ALIGN_RIGHT
|
||||
= new AttributeOption(Integer.valueOf(EditableLabel.RIGHT), __("alignEnd"));
|
||||
= new AttributeOption(Integer.valueOf(EditableLabel.RIGHT), getFromLocale("alignEnd"));
|
||||
|
||||
public static final AttributeOption PAINT_STROKE
|
||||
= new AttributeOption("stroke", __("paintStroke"));
|
||||
= new AttributeOption("stroke", getFromLocale("paintStroke"));
|
||||
public static final AttributeOption PAINT_FILL
|
||||
= new AttributeOption("fill", __("paintFill"));
|
||||
= new AttributeOption("fill", getFromLocale("paintFill"));
|
||||
public static final AttributeOption PAINT_STROKE_FILL
|
||||
= new AttributeOption("both", __("paintBoth"));
|
||||
= new AttributeOption("both", getFromLocale("paintBoth"));
|
||||
|
||||
public static final Attribute<Font> FONT
|
||||
= Attributes.forFont("font", __("attrFont"));
|
||||
= Attributes.forFont("font", getFromLocale("attrFont"));
|
||||
public static final Attribute<AttributeOption> ALIGNMENT
|
||||
= Attributes.forOption("align", __("attrAlign"),
|
||||
= Attributes.forOption("align", getFromLocale("attrAlign"),
|
||||
new AttributeOption[] { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT });
|
||||
public static final Attribute<AttributeOption> PAINT_TYPE
|
||||
= Attributes.forOption("paintType", __("attrPaint"),
|
||||
= Attributes.forOption("paintType", getFromLocale("attrPaint"),
|
||||
new AttributeOption[] { PAINT_STROKE, PAINT_FILL, PAINT_STROKE_FILL });
|
||||
public static final Attribute<Integer> STROKE_WIDTH
|
||||
= Attributes.forIntegerRange("stroke-width", __("attrStrokeWidth"), 1, 8);
|
||||
= Attributes.forIntegerRange("stroke-width", getFromLocale("attrStrokeWidth"), 1, 8);
|
||||
public static final Attribute<Color> STROKE_COLOR
|
||||
= Attributes.forColor("stroke", __("attrStroke"));
|
||||
= Attributes.forColor("stroke", getFromLocale("attrStroke"));
|
||||
public static final Attribute<Color> FILL_COLOR
|
||||
= Attributes.forColor("fill", __("attrFill"));
|
||||
= Attributes.forColor("fill", getFromLocale("attrFill"));
|
||||
public static final Attribute<Color> TEXT_DEFAULT_FILL
|
||||
= Attributes.forColor("fill", __("attrFill"));
|
||||
= Attributes.forColor("fill", getFromLocale("attrFill"));
|
||||
public static final Attribute<Integer> CORNER_RADIUS
|
||||
= Attributes.forIntegerRange("rx", __("attrRx"), 1, 1000);
|
||||
= Attributes.forIntegerRange("rx", getFromLocale("attrRx"), 1, 1000);
|
||||
|
||||
// for text
|
||||
public static final List<Attribute<?>> ATTRS_TEXT
|
||||
|
|
|
@ -74,7 +74,7 @@ public class Line extends AbstractCanvasObject {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("shapeLine");
|
||||
return getFromLocale("shapeLine");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Oval extends Rectangular {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("shapeOval");
|
||||
return getFromLocale("shapeOval");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,9 +88,9 @@ public class Poly extends FillableCanvasObject {
|
|||
@Override
|
||||
public String getDisplayName() {
|
||||
if (closed) {
|
||||
return _("shapePolygon");
|
||||
return getFromLocale("shapePolygon");
|
||||
} else {
|
||||
return _("shapePolyline");
|
||||
return getFromLocale("shapePolyline");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Rectangle extends Rectangular {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("shapeRect");
|
||||
return getFromLocale("shapeRect");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class RoundRectangle extends Rectangular {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("shapeRoundRect");
|
||||
return getFromLocale("shapeRoundRect");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,7 +77,7 @@ public class Text extends AbstractCanvasObject {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("shapeText");
|
||||
return getFromLocale("shapeText");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.cburch.draw.tools;
|
|||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
@ -17,14 +18,20 @@ import org.apache.batik.bridge.UserAgentAdapter;
|
|||
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
|
||||
import org.apache.batik.gvt.GraphicsNode;
|
||||
import org.apache.batik.util.XMLResourceDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.svg.SVGDocument;
|
||||
|
||||
import com.cburch.logisim.Main;
|
||||
|
||||
public class SVGIcon implements Icon {
|
||||
|
||||
private String path;
|
||||
private GraphicsNode svgIcon = null;
|
||||
private final static int HEIGHT = 16;
|
||||
private final static int WIDTH = 16;
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger( Main.class );
|
||||
|
||||
public SVGIcon(String path) {
|
||||
try {
|
||||
|
@ -41,8 +48,8 @@ public class SVGIcon implements Icon {
|
|||
GVTBuilder builder = new GVTBuilder();
|
||||
this.svgIcon = builder.build(ctx, doc);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Failed to load SVG icon.");
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,8 +66,10 @@ public class SVGIcon implements Icon {
|
|||
private void paintSvgIcon(Graphics2D g, int x, int y, double scaleX, double scaleY) {
|
||||
AffineTransform transform = new AffineTransform(scaleX, 0.0, 0.0, scaleY, x, y);
|
||||
svgIcon.setTransform(transform);
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
svgIcon.paint(g);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component arg0, Graphics g, int x, int y) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.cburch.logisim.gui.generic.LFrame;
|
|||
import com.cburch.logisim.gui.menu.LogisimMenuBar;
|
||||
import com.cburch.logisim.util.LocaleListener;
|
||||
import com.cburch.logisim.util.LocaleManager;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Analyzer extends LFrame {
|
||||
|
@ -40,18 +40,18 @@ public class Analyzer extends LFrame {
|
|||
private class MyListener implements LocaleListener {
|
||||
@Override
|
||||
public void localeChanged() {
|
||||
Analyzer.this.setTitle(_("analyzerWindowTitle"));
|
||||
tabbedPane.setTitleAt(INPUTS_TAB, _("inputsTab"));
|
||||
tabbedPane.setTitleAt(OUTPUTS_TAB, _("outputsTab"));
|
||||
tabbedPane.setTitleAt(TABLE_TAB, _("tableTab"));
|
||||
tabbedPane.setTitleAt(EXPRESSION_TAB, _("expressionTab"));
|
||||
tabbedPane.setTitleAt(MINIMIZED_TAB, _("minimizedTab"));
|
||||
tabbedPane.setToolTipTextAt(INPUTS_TAB, _("inputsTabTip"));
|
||||
tabbedPane.setToolTipTextAt(OUTPUTS_TAB, _("outputsTabTip"));
|
||||
tabbedPane.setToolTipTextAt(TABLE_TAB, _("tableTabTip"));
|
||||
tabbedPane.setToolTipTextAt(EXPRESSION_TAB, _("expressionTabTip"));
|
||||
tabbedPane.setToolTipTextAt(MINIMIZED_TAB, _("minimizedTabTip"));
|
||||
buildCircuit.setText(_("buildCircuitButton"));
|
||||
Analyzer.this.setTitle(getFromLocale("analyzerWindowTitle"));
|
||||
tabbedPane.setTitleAt(INPUTS_TAB, getFromLocale("inputsTab"));
|
||||
tabbedPane.setTitleAt(OUTPUTS_TAB, getFromLocale("outputsTab"));
|
||||
tabbedPane.setTitleAt(TABLE_TAB, getFromLocale("tableTab"));
|
||||
tabbedPane.setTitleAt(EXPRESSION_TAB, getFromLocale("expressionTab"));
|
||||
tabbedPane.setTitleAt(MINIMIZED_TAB, getFromLocale("minimizedTab"));
|
||||
tabbedPane.setToolTipTextAt(INPUTS_TAB, getFromLocale("inputsTabTip"));
|
||||
tabbedPane.setToolTipTextAt(OUTPUTS_TAB, getFromLocale("outputsTabTip"));
|
||||
tabbedPane.setToolTipTextAt(TABLE_TAB, getFromLocale("tableTabTip"));
|
||||
tabbedPane.setToolTipTextAt(EXPRESSION_TAB, getFromLocale("expressionTabTip"));
|
||||
tabbedPane.setToolTipTextAt(MINIMIZED_TAB, getFromLocale("minimizedTabTip"));
|
||||
buildCircuit.setText(getFromLocale("buildCircuitButton"));
|
||||
inputsPanel.localeChanged();
|
||||
outputsPanel.localeChanged();
|
||||
truthTablePanel.localeChanged();
|
||||
|
|
|
@ -8,7 +8,7 @@ import javax.swing.JFrame;
|
|||
import com.cburch.logisim.util.LocaleListener;
|
||||
import com.cburch.logisim.util.LocaleManager;
|
||||
import com.cburch.logisim.util.WindowMenuItemManager;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
public class AnalyzerManager extends WindowMenuItemManager
|
||||
implements LocaleListener {
|
||||
|
@ -32,7 +32,7 @@ public class AnalyzerManager extends WindowMenuItemManager
|
|||
private static AnalyzerManager analysisManager = null;
|
||||
|
||||
private AnalyzerManager() {
|
||||
super(_("analyzerWindowTitle"), true);
|
||||
super(getFromLocale("analyzerWindowTitle"), true);
|
||||
LocaleManager.addLocaleListener(this);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,6 @@ public class AnalyzerManager extends WindowMenuItemManager
|
|||
|
||||
@Override
|
||||
public void localeChanged() {
|
||||
setText(_("analyzerWindowTitle"));
|
||||
setText(getFromLocale("analyzerWindowTitle"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,10 +111,10 @@ class BuildCircuitButton extends JButton {
|
|||
gc.gridy++;
|
||||
gb.setConstraints(nands, gc); add(nands);
|
||||
|
||||
projectLabel.setText(_("buildProjectLabel"));
|
||||
nameLabel.setText(_("buildNameLabel"));
|
||||
twoInputs.setText(_("buildTwoInputsLabel"));
|
||||
nands.setText(_("buildNandsLabel"));
|
||||
projectLabel.setText(getFromLocale("buildProjectLabel"));
|
||||
nameLabel.setText(getFromLocale("buildNameLabel"));
|
||||
twoInputs.setText(getFromLocale("buildTwoInputsLabel"));
|
||||
nands.setText(getFromLocale("buildNandsLabel"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ class BuildCircuitButton extends JButton {
|
|||
while (!ok) {
|
||||
DialogPanel dlog = new DialogPanel();
|
||||
int action = JOptionPane.showConfirmDialog(parent,
|
||||
dlog, _("buildDialogTitle"), JOptionPane.OK_CANCEL_OPTION,
|
||||
dlog, getFromLocale("buildDialogTitle"), JOptionPane.OK_CANCEL_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
if (action != JOptionPane.OK_OPTION) {
|
||||
return;
|
||||
|
@ -140,23 +140,23 @@ class BuildCircuitButton extends JButton {
|
|||
|
||||
ProjectItem projectItem = (ProjectItem) dlog.project.getSelectedItem();
|
||||
if (projectItem == null) {
|
||||
JOptionPane.showMessageDialog(parent, _("buildNeedProjectError"),
|
||||
_("buildDialogErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(parent, getFromLocale("buildNeedProjectError"),
|
||||
getFromLocale("buildDialogErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
continue;
|
||||
}
|
||||
dest = projectItem.project;
|
||||
|
||||
name = dlog.name.getText().trim();
|
||||
if (name.equals("")) {
|
||||
JOptionPane.showMessageDialog(parent, _("buildNeedCircuitError"),
|
||||
_("buildDialogErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(parent, getFromLocale("buildNeedCircuitError"),
|
||||
getFromLocale("buildDialogErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dest.getLogisimFile().getCircuit(name) != null) {
|
||||
int choice = JOptionPane.showConfirmDialog(parent,
|
||||
_("buildConfirmReplaceMessage", name),
|
||||
_("buildConfirmReplaceTitle"), JOptionPane.YES_NO_OPTION);
|
||||
getFromLocale("buildConfirmReplaceMessage", name),
|
||||
getFromLocale("buildConfirmReplaceTitle"), JOptionPane.YES_NO_OPTION);
|
||||
if (choice != JOptionPane.YES_OPTION) {
|
||||
continue;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class BuildCircuitButton extends JButton {
|
|||
}
|
||||
|
||||
void localeChanged() {
|
||||
setText(_("buildCircuitButton"));
|
||||
setText(getFromLocale("buildCircuitButton"));
|
||||
}
|
||||
|
||||
private void performAction(Project dest, String name, boolean replace,
|
||||
|
@ -199,7 +199,7 @@ class BuildCircuitButton extends JButton {
|
|||
|
||||
CircuitMutation xn = CircuitBuilder.build(circuit, model, twoInputs,
|
||||
useNands);
|
||||
dest.doAction(xn.toAction(__("replaceCircuitAction")));
|
||||
dest.doAction(xn.toAction(getFromLocale("replaceCircuitAction")));
|
||||
} else {
|
||||
// add the circuit
|
||||
Circuit circuit = new Circuit(name);
|
||||
|
|
|
@ -29,8 +29,7 @@ import com.cburch.logisim.analyze.model.OutputExpressionsListener;
|
|||
import com.cburch.logisim.analyze.model.Expression;
|
||||
import com.cburch.logisim.analyze.model.Parser;
|
||||
import com.cburch.logisim.analyze.model.ParserException;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class ExpressionTab extends AnalyzerTab implements TabInterface {
|
||||
|
@ -132,7 +131,7 @@ class ExpressionTab extends AnalyzerTab implements TabInterface {
|
|||
private MyListener myListener = new MyListener();
|
||||
private AnalyzerModel model;
|
||||
private int curExprStringLength = 0;
|
||||
private StringGetter errorMessage;
|
||||
private String errorMessage;
|
||||
|
||||
public ExpressionTab(AnalyzerModel model) {
|
||||
this.model = model;
|
||||
|
@ -186,9 +185,9 @@ class ExpressionTab extends AnalyzerTab implements TabInterface {
|
|||
void localeChanged() {
|
||||
selector.localeChanged();
|
||||
prettyView.localeChanged();
|
||||
clear.setText(_("exprClearButton"));
|
||||
revert.setText(_("exprRevertButton"));
|
||||
enter.setText(_("exprEnterButton"));
|
||||
clear.setText(getFromLocale("exprClearButton"));
|
||||
revert.setText(getFromLocale("exprRevertButton"));
|
||||
enter.setText(getFromLocale("exprEnterButton"));
|
||||
if (errorMessage != null) {
|
||||
error.setText(errorMessage.toString());
|
||||
}
|
||||
|
@ -209,7 +208,7 @@ class ExpressionTab extends AnalyzerTab implements TabInterface {
|
|||
return selector.getSelectedOutput();
|
||||
}
|
||||
|
||||
private void setError(StringGetter msg) {
|
||||
private void setError(String msg) {
|
||||
if (msg == null) {
|
||||
errorMessage = null;
|
||||
error.setText(" ");
|
||||
|
|
|
@ -14,7 +14,7 @@ import javax.swing.JPanel;
|
|||
|
||||
import com.cburch.logisim.analyze.model.Expression;
|
||||
import com.cburch.logisim.analyze.model.ExpressionVisitor;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class ExpressionView extends JPanel {
|
||||
|
@ -242,7 +242,7 @@ class ExpressionView extends JPanel {
|
|||
lineY = new int[] { MINIMUM_HEIGHT };
|
||||
} else {
|
||||
if (exprData.text.length() == 0) {
|
||||
lineText = new String[] { _("expressionEmpty") };
|
||||
lineText = new String[] { getFromLocale("expressionEmpty") };
|
||||
lineNots = new ArrayList<ArrayList<NotData>>();
|
||||
lineNots.add(new ArrayList<NotData>());
|
||||
} else {
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.cburch.logisim.analyze.model.TruthTableEvent;
|
|||
import com.cburch.logisim.analyze.model.TruthTableListener;
|
||||
import com.cburch.logisim.analyze.model.VariableList;
|
||||
import com.cburch.logisim.util.GraphicsUtil;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class KarnaughMapPanel extends JPanel implements TruthTablePanel {
|
||||
|
@ -165,9 +165,9 @@ class KarnaughMapPanel extends JPanel implements TruthTablePanel {
|
|||
|
||||
String message = null;
|
||||
if (output == null) {
|
||||
message = _("karnaughNoOutputError");
|
||||
message = getFromLocale("karnaughNoOutputError");
|
||||
} else if (table.getInputColumnCount() > MAX_VARS) {
|
||||
message = _("karnaughTooManyInputsError");
|
||||
message = getFromLocale("karnaughTooManyInputsError");
|
||||
}
|
||||
if (message != null) {
|
||||
if (g == null) {
|
||||
|
@ -214,9 +214,9 @@ class KarnaughMapPanel extends JPanel implements TruthTablePanel {
|
|||
Dimension sz = getSize();
|
||||
String message = null;
|
||||
if (output == null) {
|
||||
message = _("karnaughNoOutputError");
|
||||
message = getFromLocale("karnaughNoOutputError");
|
||||
} else if (inputCount > MAX_VARS) {
|
||||
message = _("karnaughTooManyInputsError");
|
||||
message = getFromLocale("karnaughTooManyInputsError");
|
||||
}
|
||||
if (message != null) {
|
||||
g.setFont(BODY_FONT);
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.cburch.logisim.analyze.model.AnalyzerModel;
|
|||
import com.cburch.logisim.analyze.model.OutputExpressions;
|
||||
import com.cburch.logisim.analyze.model.OutputExpressionsEvent;
|
||||
import com.cburch.logisim.analyze.model.OutputExpressionsListener;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class MinimizedTab extends AnalyzerTab {
|
||||
|
@ -45,8 +45,8 @@ class MinimizedTab extends AnalyzerTab {
|
|||
}
|
||||
|
||||
void localeChanged() {
|
||||
choices[0] = _("minimizedSumOfProducts");
|
||||
choices[1] = _("minimizedProductOfSums");
|
||||
choices[0] = getFromLocale("minimizedSumOfProducts");
|
||||
choices[1] = getFromLocale("minimizedProductOfSums");
|
||||
fireContentsChanged(this, 0, choices.length);
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,8 @@ class MinimizedTab extends AnalyzerTab {
|
|||
selector.localeChanged();
|
||||
karnaughMap.localeChanged();
|
||||
minimizedExpr.localeChanged();
|
||||
setAsExpr.setText(_("minimizedSetButton"));
|
||||
formatLabel.setText(_("minimizedFormat"));
|
||||
setAsExpr.setText(getFromLocale("minimizedSetButton"));
|
||||
formatLabel.setText(getFromLocale("minimizedFormat"));
|
||||
((FormatModel) formatChoice.getModel()).localeChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.cburch.logisim.analyze.model.AnalyzerModel;
|
|||
import com.cburch.logisim.analyze.model.VariableList;
|
||||
import com.cburch.logisim.analyze.model.VariableListEvent;
|
||||
import com.cburch.logisim.analyze.model.VariableListListener;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class OutputSelector {
|
||||
|
@ -132,7 +132,7 @@ class OutputSelector {
|
|||
}
|
||||
|
||||
void localeChanged() {
|
||||
label.setText(_("outputSelectLabel"));
|
||||
label.setText(getFromLocale("outputSelectLabel"));
|
||||
}
|
||||
|
||||
public void addItemListener(ItemListener l) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.cburch.logisim.analyze.model.TruthTable;
|
|||
import com.cburch.logisim.analyze.model.TruthTableEvent;
|
||||
import com.cburch.logisim.analyze.model.TruthTableListener;
|
||||
import com.cburch.logisim.util.GraphicsUtil;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class TableTab extends JPanel implements TruthTablePanel, TabInterface {
|
||||
|
@ -140,7 +140,7 @@ class TableTab extends JPanel implements TruthTablePanel, TabInterface {
|
|||
int outputs = table.getOutputColumnCount();
|
||||
if (inputs == 0 && outputs == 0) {
|
||||
g.setFont(BODY_FONT);
|
||||
GraphicsUtil.drawCenteredText(g, _("tableEmptyMessage"), sz.width / 2, sz.height / 2);
|
||||
GraphicsUtil.drawCenteredText(g, getFromLocale("tableEmptyMessage"), sz.width / 2, sz.height / 2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -158,14 +158,14 @@ class TableTab extends JPanel implements TruthTablePanel, TabInterface {
|
|||
int x = left;
|
||||
int y = top + headerMetric.getAscent() + 1;
|
||||
if (inputs == 0) {
|
||||
x = paintHeader(_("tableNullHeader"), x, y, g, headerMetric);
|
||||
x = paintHeader(getFromLocale("tableNullHeader"), x, y, g, headerMetric);
|
||||
} else {
|
||||
for (int i = 0; i < inputs; i++) {
|
||||
x = paintHeader(table.getInputHeader(i), x, y, g, headerMetric);
|
||||
}
|
||||
}
|
||||
if (outputs == 0) {
|
||||
x = paintHeader(_("tableNullHeader"), x, y, g, headerMetric);
|
||||
x = paintHeader(getFromLocale("tableNullHeader"), x, y, g, headerMetric);
|
||||
} else {
|
||||
for (int i = 0; i < outputs; i++) {
|
||||
x = paintHeader(table.getOutputHeader(i), x, y, g, headerMetric);
|
||||
|
@ -257,7 +257,7 @@ class TableTab extends JPanel implements TruthTablePanel, TabInterface {
|
|||
cellHeight = fm.getHeight();
|
||||
cellWidth = 24;
|
||||
if (inputs == 0 || outputs == 0) {
|
||||
cellWidth = Math.max(cellWidth, fm.stringWidth(_("tableNullHeader")));
|
||||
cellWidth = Math.max(cellWidth, fm.stringWidth(getFromLocale("tableNullHeader")));
|
||||
}
|
||||
for (int i = 0; i < inputs + outputs; i++) {
|
||||
String header = i < inputs ? table.getInputHeader(i)
|
||||
|
|
|
@ -16,7 +16,7 @@ import javax.swing.JOptionPane;
|
|||
|
||||
import com.cburch.logisim.analyze.model.Entry;
|
||||
import com.cburch.logisim.analyze.model.TruthTable;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class TableTabClip implements ClipboardOwner {
|
||||
|
@ -119,8 +119,8 @@ class TableTabClip implements ClipboardOwner {
|
|||
// I don't know - the above was observed to throw an odd ArrayIndexOutOfBounds
|
||||
// exception on a Linux computer using Sun's Java 5 JVM
|
||||
JOptionPane.showMessageDialog(table.getRootPane(),
|
||||
_("clipPasteSupportedError"),
|
||||
_("clipPasteErrorTitle"),
|
||||
getFromLocale("clipPasteSupportedError"),
|
||||
getFromLocale("clipPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ class TableTabClip implements ClipboardOwner {
|
|||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(table.getRootPane(),
|
||||
_("clipPasteSupportedError"),
|
||||
_("clipPasteErrorTitle"),
|
||||
getFromLocale("clipPasteSupportedError"),
|
||||
getFromLocale("clipPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ class TableTabClip implements ClipboardOwner {
|
|||
if (r0 + entries.length > rows
|
||||
|| c0 + entries[0].length > inputs + outputs) {
|
||||
JOptionPane.showMessageDialog(table.getRootPane(),
|
||||
_("clipPasteEndError"),
|
||||
_("clipPasteErrorTitle"),
|
||||
getFromLocale("clipPasteEndError"),
|
||||
getFromLocale("clipPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ class TableTabClip implements ClipboardOwner {
|
|||
if (r1 - r0 + 1 != entries.length
|
||||
|| c1 - c0 + 1 != entries[0].length) {
|
||||
JOptionPane.showMessageDialog(table.getRootPane(),
|
||||
_("clipPasteSizeError"),
|
||||
_("clipPasteErrorTitle"),
|
||||
getFromLocale("clipPasteSizeError"),
|
||||
getFromLocale("clipPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import javax.swing.event.ListSelectionListener;
|
|||
import com.cburch.logisim.analyze.model.VariableList;
|
||||
import com.cburch.logisim.analyze.model.VariableListEvent;
|
||||
import com.cburch.logisim.analyze.model.VariableListListener;
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class VariableTab extends AnalyzerTab implements TabInterface {
|
||||
|
@ -229,11 +229,11 @@ class VariableTab extends AnalyzerTab implements TabInterface {
|
|||
|
||||
@Override
|
||||
void localeChanged() {
|
||||
remove.setText(_("variableRemoveButton"));
|
||||
moveUp.setText(_("variableMoveUpButton"));
|
||||
moveDown.setText(_("variableMoveDownButton"));
|
||||
add.setText(_("variableAddButton"));
|
||||
rename.setText(_("variableRenameButton"));
|
||||
remove.setText(getFromLocale("variableRemoveButton"));
|
||||
moveUp.setText(getFromLocale("variableMoveUpButton"));
|
||||
moveDown.setText(getFromLocale("variableMoveDownButton"));
|
||||
add.setText(getFromLocale("variableAddButton"));
|
||||
rename.setText(getFromLocale("variableRenameButton"));
|
||||
validateInput();
|
||||
}
|
||||
|
||||
|
@ -268,13 +268,13 @@ class VariableTab extends AnalyzerTab implements TabInterface {
|
|||
errorShown = false;
|
||||
ok = false;
|
||||
} else if (!Character.isJavaIdentifierStart(text.charAt(0))) {
|
||||
error.setText(_("variableStartError"));
|
||||
error.setText(getFromLocale("variableStartError"));
|
||||
ok = false;
|
||||
} else {
|
||||
for (int i = 1; i < text.length() && ok; i++) {
|
||||
char c = text.charAt(i);
|
||||
if (!Character.isJavaIdentifierPart(c)) {
|
||||
error.setText(_("variablePartError", "" + c));
|
||||
error.setText(getFromLocale("variablePartError", "" + c));
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
@ -283,14 +283,14 @@ class VariableTab extends AnalyzerTab implements TabInterface {
|
|||
for (int i = 0, n = data.size(); i < n && ok; i++) {
|
||||
String other = data.get(i);
|
||||
if (text.equals(other)) {
|
||||
error.setText(_("variableDuplicateError"));
|
||||
error.setText(getFromLocale("variableDuplicateError"));
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok || !errorShown) {
|
||||
if (data.size() >= data.getMaximumSize()) {
|
||||
error.setText(_("variableMaximumError", "" + data.getMaximumSize()));
|
||||
error.setText(getFromLocale("variableMaximumError", "" + data.getMaximumSize()));
|
||||
} else {
|
||||
error.setText(" ");
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
|
||||
package com.cburch.logisim.analyze.model;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public class Entry {
|
||||
public static final Entry ZERO = new Entry("0");
|
||||
public static final Entry ONE = new Entry("1");
|
||||
public static final Entry DONT_CARE = new Entry("x");
|
||||
public static final Entry BUS_ERROR = new Entry(__("busError"));
|
||||
public static final Entry OSCILLATE_ERROR = new Entry(__("oscillateError"));
|
||||
public static final Entry BUS_ERROR = new Entry(getFromLocale("busError"), true);
|
||||
public static final Entry OSCILLATE_ERROR = new Entry(getFromLocale("oscillateError"), true);
|
||||
|
||||
public static Entry parse(String description) {
|
||||
if (ZERO.description.equals(description)) {
|
||||
|
@ -34,16 +33,16 @@ public class Entry {
|
|||
}
|
||||
|
||||
private String description;
|
||||
private StringGetter errorMessage;
|
||||
private String errorMessage;
|
||||
|
||||
private Entry(String description) {
|
||||
this.description = description;
|
||||
this.errorMessage = null;
|
||||
}
|
||||
|
||||
private Entry(StringGetter errorMessage) {
|
||||
this.description = "!!";
|
||||
this.errorMessage = errorMessage;
|
||||
private Entry(String message, boolean... isError) {
|
||||
if (isError.length > 0 && isError[0]) {
|
||||
this.description = "!!";
|
||||
this.errorMessage = message;
|
||||
} else {
|
||||
this.description = message;
|
||||
this.errorMessage = null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
|
@ -5,7 +5,6 @@ package com.cburch.logisim.analyze.model;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public class Parser {
|
||||
|
@ -21,7 +20,7 @@ public class Parser {
|
|||
|
||||
for (Token token : tokens) {
|
||||
if (token.type == TOKEN_ERROR) {
|
||||
throw token.error(__("invalidCharacterError", token.text));
|
||||
throw token.error(getFromLocale("invalidCharacterError", token.text));
|
||||
} else if (token.type == TOKEN_IDENT) {
|
||||
int index = model.getInputs().indexOf(token.text);
|
||||
if (index < 0) {
|
||||
|
@ -36,7 +35,7 @@ public class Parser {
|
|||
} else if (opText.equals("OR")) {
|
||||
token.type = TOKEN_OR;
|
||||
} else {
|
||||
throw token.error(__("badVariableName", token.text));
|
||||
throw token.error(getFromLocale("badVariableName", token.text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +125,7 @@ public class Parser {
|
|||
this.text = text;
|
||||
}
|
||||
|
||||
ParserException error(StringGetter message) {
|
||||
ParserException error(String message) {
|
||||
return new ParserException(message, offset, length);
|
||||
}
|
||||
}
|
||||
|
@ -228,16 +227,16 @@ public class Parser {
|
|||
} else if (t.type == TOKEN_NOT) {
|
||||
if (current != null) {
|
||||
push(stack, current, Expression.AND_LEVEL,
|
||||
new Token(TOKEN_AND, t.offset, _("implicitAndOperator")));
|
||||
new Token(TOKEN_AND, t.offset, getFromLocale("implicitAndOperator")));
|
||||
}
|
||||
push(stack, null, Expression.NOT_LEVEL, t);
|
||||
current = null;
|
||||
} else if (t.type == TOKEN_NOT_POSTFIX) {
|
||||
throw t.error(__("unexpectedApostrophe"));
|
||||
throw t.error(getFromLocale("unexpectedApostrophe"));
|
||||
} else if (t.type == TOKEN_LPAREN) {
|
||||
if (current != null) {
|
||||
push(stack, current, Expression.AND_LEVEL,
|
||||
new Token(TOKEN_AND, t.offset, 0, _("implicitAndOperator")));
|
||||
new Token(TOKEN_AND, t.offset, 0, getFromLocale("implicitAndOperator")));
|
||||
}
|
||||
push(stack, null, -2, t);
|
||||
current = null;
|
||||
|
@ -245,7 +244,7 @@ public class Parser {
|
|||
current = popTo(stack, -1, current);
|
||||
// there had better be a LPAREN atop the stack now.
|
||||
if (stack.isEmpty()) {
|
||||
throw t.error(__("lparenMissingError"));
|
||||
throw t.error(getFromLocale("lparenMissingError"));
|
||||
}
|
||||
pop(stack);
|
||||
while (i + 1 < tokens.size() && tokens.get(i + 1).type == TOKEN_NOT_POSTFIX) {
|
||||
|
@ -255,7 +254,7 @@ public class Parser {
|
|||
current = popTo(stack, Expression.AND_LEVEL, current);
|
||||
} else {
|
||||
if (current == null) {
|
||||
throw t.error(__("missingLeftOperandError", t.text));
|
||||
throw t.error(getFromLocale("missingLeftOperandError", t.text));
|
||||
}
|
||||
int level = 0;
|
||||
switch (t.type) {
|
||||
|
@ -270,7 +269,7 @@ public class Parser {
|
|||
current = popTo(stack, -1, current);
|
||||
if (!stack.isEmpty()) {
|
||||
Context top = pop(stack);
|
||||
throw top.cause.error(__("rparenMissingError"));
|
||||
throw top.cause.error(getFromLocale("rparenMissingError"));
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
@ -295,7 +294,7 @@ public class Parser {
|
|||
while (!stack.isEmpty() && peekLevel(stack) >= level) {
|
||||
Context top = pop(stack);
|
||||
if (current == null) {
|
||||
throw top.cause.error(__("missingRightOperandError", top.cause.text));
|
||||
throw top.cause.error(getFromLocale("missingRightOperandError", top.cause.text));
|
||||
}
|
||||
|
||||
switch (top.level) {
|
||||
|
|
|
@ -3,15 +3,13 @@
|
|||
|
||||
package com.cburch.logisim.analyze.model;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ParserException extends Exception {
|
||||
private StringGetter message;
|
||||
private String message;
|
||||
private int start;
|
||||
private int length;
|
||||
|
||||
public ParserException(StringGetter message, int start, int length) {
|
||||
public ParserException(String message, int start, int length) {
|
||||
super(message.toString());
|
||||
this.message = message;
|
||||
this.start = start;
|
||||
|
@ -23,7 +21,7 @@ public class ParserException extends Exception {
|
|||
return message.toString();
|
||||
}
|
||||
|
||||
public StringGetter getMessageGetter() {
|
||||
public String getMessageGetter() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,12 +100,12 @@ public class Analyze {
|
|||
|
||||
String defaultList;
|
||||
if (Pin.FACTORY.isInputPin(pin)) {
|
||||
defaultList = _("defaultInputLabels");
|
||||
defaultList = getFromLocale("defaultInputLabels");
|
||||
if (defaultList.indexOf(",") < 0) {
|
||||
defaultList = "a,b,c,d,e,f,g,h";
|
||||
}
|
||||
} else {
|
||||
defaultList = _("defaultOutputLabels");
|
||||
defaultList = getFromLocale("defaultOutputLabels");
|
||||
if (defaultList.indexOf(",") < 0) {
|
||||
defaultList = "x,y,z,u,v,w,s,t";
|
||||
}
|
||||
|
|
|
@ -11,19 +11,19 @@ public class AnalyzeException extends Exception {
|
|||
public static class Circular extends AnalyzeException {
|
||||
|
||||
public Circular() {
|
||||
super(_("analyzeCircularError"));
|
||||
super(getFromLocale("analyzeCircularError"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Conflict extends AnalyzeException {
|
||||
public Conflict() {
|
||||
super(_("analyzeConflictError"));
|
||||
super(getFromLocale("analyzeConflictError"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class CannotHandle extends AnalyzeException {
|
||||
public CannotHandle(String reason) {
|
||||
super(_("analyzeCannotHandleError", reason));
|
||||
super(getFromLocale("analyzeCannotHandleError", reason));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,13 @@ package com.cburch.logisim.circuit;
|
|||
|
||||
import com.cburch.logisim.proj.Action;
|
||||
import com.cburch.logisim.proj.Project;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
public class CircuitAction extends Action {
|
||||
private StringGetter name;
|
||||
private String name;
|
||||
private CircuitTransaction forward;
|
||||
private CircuitTransaction reverse;
|
||||
|
||||
CircuitAction(StringGetter name, CircuitMutation forward) {
|
||||
CircuitAction(String name, CircuitMutation forward) {
|
||||
this.name = name;
|
||||
this.forward = forward;
|
||||
}
|
||||
|
|
|
@ -23,19 +23,19 @@ import static com.cburch.logisim.util.LocaleString.*;
|
|||
|
||||
public class CircuitAttributes extends AbstractAttributeSet {
|
||||
public static final Attribute<String> NAME_ATTR
|
||||
= Attributes.forString("circuit", __("circuitName"));
|
||||
= Attributes.forString("circuit", getFromLocale("circuitName"));
|
||||
|
||||
public static final Attribute<Direction> LABEL_LOCATION_ATTR
|
||||
= Attributes.forDirection("labelloc", __("circuitLabelLocAttr"));
|
||||
= Attributes.forDirection("labelloc", getFromLocale("circuitLabelLocAttr"));
|
||||
|
||||
public static final Attribute<String> CIRCUIT_LABEL_ATTR
|
||||
= Attributes.forString("clabel", __("circuitLabelAttr"));
|
||||
= Attributes.forString("clabel", getFromLocale("circuitLabelAttr"));
|
||||
|
||||
public static final Attribute<Direction> CIRCUIT_LABEL_FACING_ATTR
|
||||
= Attributes.forDirection("clabelup", __("circuitLabelDirAttr"));
|
||||
= Attributes.forDirection("clabelup", getFromLocale("circuitLabelDirAttr"));
|
||||
|
||||
public static final Attribute<Font> CIRCUIT_LABEL_FONT_ATTR
|
||||
= Attributes.forFont("clabelfont", __("circuitLabelFontAttr"));
|
||||
= Attributes.forFont("clabelfont", getFromLocale("circuitLabelFontAttr"));
|
||||
|
||||
private static final Attribute<?>[] STATIC_ATTRS = {
|
||||
NAME_ATTR, CIRCUIT_LABEL_ATTR, CIRCUIT_LABEL_FACING_ATTR, CIRCUIT_LABEL_FONT_ATTR,
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.Map;
|
|||
import com.cburch.logisim.comp.Component;
|
||||
import com.cburch.logisim.data.Attribute;
|
||||
import com.cburch.logisim.proj.Action;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public final class CircuitMutation extends CircuitTransaction {
|
||||
|
@ -77,9 +76,9 @@ public final class CircuitMutation extends CircuitTransaction {
|
|||
changes.add(change);
|
||||
}
|
||||
|
||||
public Action toAction(StringGetter name) {
|
||||
public Action toAction(String name) {
|
||||
if (name == null) {
|
||||
name = __("unknownChangeAction");
|
||||
name = getFromLocale("unknownChangeAction");
|
||||
}
|
||||
|
||||
return new CircuitAction(name, this);
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.cburch.logisim.data.AttributeOption;
|
|||
import com.cburch.logisim.data.Attributes;
|
||||
import com.cburch.logisim.data.BitWidth;
|
||||
import com.cburch.logisim.data.Value;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public abstract class RadixOption extends AttributeOption {
|
||||
|
@ -22,7 +21,7 @@ public abstract class RadixOption extends AttributeOption {
|
|||
RADIX_2, RADIX_8, RADIX_10_SIGNED, RADIX_10_UNSIGNED, RADIX_16
|
||||
};
|
||||
public static final Attribute<RadixOption> ATTRIBUTE
|
||||
= Attributes.forOption("radix", __("radixAttr"), OPTIONS);
|
||||
= Attributes.forOption("radix", getFromLocale("radixAttr"), OPTIONS);
|
||||
|
||||
public static RadixOption decode(String value) {
|
||||
for (RadixOption opt : OPTIONS) {
|
||||
|
@ -34,15 +33,15 @@ public abstract class RadixOption extends AttributeOption {
|
|||
}
|
||||
|
||||
private String saveName;
|
||||
private StringGetter displayGetter;
|
||||
private String displayGetter;
|
||||
|
||||
private RadixOption(String saveName, StringGetter displayGetter) {
|
||||
private RadixOption(String saveName, String displayGetter) {
|
||||
super(saveName, displayGetter);
|
||||
this.saveName = saveName;
|
||||
this.displayGetter = displayGetter;
|
||||
}
|
||||
|
||||
public StringGetter getDisplayGetter() {
|
||||
public String getDisplayGetter() {
|
||||
return displayGetter;
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,7 @@ public abstract class RadixOption extends AttributeOption {
|
|||
|
||||
private static class Radix2 extends RadixOption {
|
||||
private Radix2() {
|
||||
super("2", __("radix2"));
|
||||
super("2", getFromLocale("radix2"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +93,7 @@ public abstract class RadixOption extends AttributeOption {
|
|||
|
||||
private static class Radix10Signed extends RadixOption {
|
||||
private Radix10Signed() {
|
||||
super("10signed", __("radix10Signed"));
|
||||
super("10signed", getFromLocale("radix10Signed"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,7 +131,7 @@ public abstract class RadixOption extends AttributeOption {
|
|||
|
||||
private static class Radix10Unsigned extends RadixOption {
|
||||
private Radix10Unsigned() {
|
||||
super("10unsigned", __("radix10Unsigned"));
|
||||
super("10unsigned", getFromLocale("radix10Unsigned"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +158,7 @@ public abstract class RadixOption extends AttributeOption {
|
|||
|
||||
private static class Radix8 extends RadixOption {
|
||||
private Radix8() {
|
||||
super("8", __("radix8"));
|
||||
super("8", getFromLocale("radix8"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -180,7 +179,7 @@ public abstract class RadixOption extends AttributeOption {
|
|||
|
||||
private static class Radix16 extends RadixOption {
|
||||
private Radix16() {
|
||||
super("16", __("radix16"));
|
||||
super("16", getFromLocale("radix16"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -213,7 +213,7 @@ public class Simulator {
|
|||
|
||||
public void tick() {
|
||||
ticker.tickOnce();
|
||||
}
|
||||
}
|
||||
|
||||
public void step() {
|
||||
synchronized(manager) {
|
||||
|
|
|
@ -166,7 +166,7 @@ public class Splitter extends ManagedComponent
|
|||
}
|
||||
|
||||
if (end == 0) {
|
||||
return _("splitterCombinedTip");
|
||||
return getFromLocale("splitterCombinedTip");
|
||||
} else if (end > 0){
|
||||
int bits = 0;
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
@ -198,7 +198,7 @@ public class Splitter extends ManagedComponent
|
|||
case 1: base = "splitterSplit1Tip"; break;
|
||||
default: base = "splitterSplitManyTip"; break;
|
||||
}
|
||||
return _(base, buf.toString());
|
||||
return getFromLocale(base, buf.toString());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -18,23 +18,23 @@ import static com.cburch.logisim.util.LocaleString.*;
|
|||
|
||||
class SplitterAttributes extends AbstractAttributeSet {
|
||||
public static final AttributeOption APPEAR_LEGACY
|
||||
= new AttributeOption("legacy", __("splitterAppearanceLegacy"));
|
||||
= new AttributeOption("legacy", getFromLocale("splitterAppearanceLegacy"));
|
||||
public static final AttributeOption APPEAR_LEFT
|
||||
= new AttributeOption("left", __("splitterAppearanceLeft"));
|
||||
= new AttributeOption("left", getFromLocale("splitterAppearanceLeft"));
|
||||
public static final AttributeOption APPEAR_RIGHT
|
||||
= new AttributeOption("right", __("splitterAppearanceRight"));
|
||||
= new AttributeOption("right", getFromLocale("splitterAppearanceRight"));
|
||||
public static final AttributeOption APPEAR_CENTER
|
||||
= new AttributeOption("center", __("splitterAppearanceCenter"));
|
||||
= new AttributeOption("center", getFromLocale("splitterAppearanceCenter"));
|
||||
|
||||
public static final Attribute<AttributeOption> ATTR_APPEARANCE
|
||||
= Attributes.forOption("appear", __("splitterAppearanceAttr"),
|
||||
= Attributes.forOption("appear", getFromLocale("splitterAppearanceAttr"),
|
||||
new AttributeOption[] { APPEAR_LEFT, APPEAR_RIGHT, APPEAR_CENTER,
|
||||
APPEAR_LEGACY});
|
||||
|
||||
public static final Attribute<BitWidth> ATTR_WIDTH
|
||||
= Attributes.forBitWidth("incoming", __("splitterBitWidthAttr"));
|
||||
= Attributes.forBitWidth("incoming", getFromLocale("splitterBitWidthAttr"));
|
||||
public static final Attribute<Integer> ATTR_FANOUT
|
||||
= Attributes.forIntegerRange("fanout", __("splitterFanOutAttr"), 1, 32);
|
||||
= Attributes.forIntegerRange("fanout", getFromLocale("splitterFanOutAttr"), 1, 32);
|
||||
|
||||
private static final List<Attribute<?>> INIT_ATTRIBUTES
|
||||
= Arrays.asList(new Attribute<?>[] {
|
||||
|
@ -57,7 +57,7 @@ class SplitterAttributes extends AbstractAttributeSet {
|
|||
@Override
|
||||
public String toString() {
|
||||
if (value < 0) {
|
||||
return _("splitterBitNone");
|
||||
return getFromLocale("splitterBitNone");
|
||||
} else {
|
||||
String ret = "" + value;
|
||||
Direction noteDir;
|
||||
|
@ -81,7 +81,7 @@ class SplitterAttributes extends AbstractAttributeSet {
|
|||
BitOutOption[] options;
|
||||
|
||||
private BitOutAttribute(int which, BitOutOption[] options) {
|
||||
super("bit" + which, __("splitterBitAttr", "" + which));
|
||||
super("bit" + which, getFromLocale("splitterBitAttr", "" + which));
|
||||
this.which = which;
|
||||
this.options = options;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.awt.event.ActionListener;
|
|||
import javax.swing.JMenuItem;
|
||||
|
||||
import com.cburch.logisim.proj.Project;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
@ -38,11 +37,11 @@ class SplitterDistributeItem extends JMenuItem implements ActionListener {
|
|||
setText(toGetter().toString());
|
||||
}
|
||||
|
||||
private StringGetter toGetter() {
|
||||
private String toGetter() {
|
||||
if (order > 0) {
|
||||
return __("splitterDistributeAscending");
|
||||
return getFromLocale("splitterDistributeAscending");
|
||||
} else {
|
||||
return __("splitterDistributeDescending");
|
||||
return getFromLocale("splitterDistributeDescending");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.cburch.logisim.tools.key.JoinedConfigurator;
|
|||
import com.cburch.logisim.tools.key.KeyConfigurator;
|
||||
import com.cburch.logisim.tools.key.ParallelConfigurator;
|
||||
import com.cburch.logisim.util.Icons;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public class SplitterFactory extends AbstractComponentFactory {
|
||||
|
@ -38,8 +37,8 @@ public class SplitterFactory extends AbstractComponentFactory {
|
|||
public String getName() { return "Splitter"; }
|
||||
|
||||
@Override
|
||||
public StringGetter getDisplayGetter() {
|
||||
return __("splitterComponent");
|
||||
public String getDisplayGetter() {
|
||||
return getFromLocale("splitterComponent");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,12 +35,11 @@ import com.cburch.logisim.proj.Project;
|
|||
import com.cburch.logisim.std.wiring.Pin;
|
||||
import com.cburch.logisim.tools.MenuExtender;
|
||||
import com.cburch.logisim.util.GraphicsUtil;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import com.cburch.logisim.util.StringUtil;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public class SubcircuitFactory extends InstanceFactory {
|
||||
private class CircuitFeature implements StringGetter, MenuExtender, ActionListener {
|
||||
private class CircuitFeature implements MenuExtender, ActionListener {
|
||||
private Instance instance;
|
||||
private Project proj;
|
||||
|
||||
|
@ -57,7 +56,7 @@ public class SubcircuitFactory extends InstanceFactory {
|
|||
public void configureMenu(JPopupMenu menu, Project proj) {
|
||||
this.proj = proj;
|
||||
String name = instance.getFactory().getDisplayName();
|
||||
String text = _("subcircuitViewItem", name);
|
||||
String text = getFromLocale("subcircuitViewItem", name);
|
||||
JMenuItem item = new JMenuItem(text);
|
||||
item.addActionListener(this);
|
||||
menu.add(item);
|
||||
|
@ -86,7 +85,7 @@ public class SubcircuitFactory extends InstanceFactory {
|
|||
super("", null);
|
||||
this.source = source;
|
||||
setFacingAttribute(StdAttr.FACING);
|
||||
setDefaultToolTip(new CircuitFeature(null));
|
||||
setDefaultToolTip(null);
|
||||
setInstancePoker(SubcircuitPoker.class);
|
||||
}
|
||||
|
||||
|
@ -100,7 +99,7 @@ public class SubcircuitFactory extends InstanceFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public StringGetter getDisplayGetter() {
|
||||
public String getDisplayGetter() {
|
||||
return StringUtil.constantGetter(source.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ public final class Wire implements Component, AttributeSet, CustomHandles,
|
|||
public static final int WIDTH = 1;
|
||||
|
||||
public static final AttributeOption VALUE_HORZ
|
||||
= new AttributeOption("horz", __("wireDirectionHorzOption"));
|
||||
= new AttributeOption("horz", getFromLocale("wireDirectionHorzOption"));
|
||||
public static final AttributeOption VALUE_VERT
|
||||
= new AttributeOption("vert", __("wireDirectionVertOption"));
|
||||
= new AttributeOption("vert", getFromLocale("wireDirectionVertOption"));
|
||||
public static final Attribute<AttributeOption> dir_attr
|
||||
= Attributes.forOption("direction", __("wireDirectionAttr"),
|
||||
= Attributes.forOption("direction", getFromLocale("wireDirectionAttr"),
|
||||
new AttributeOption[] { VALUE_HORZ, VALUE_VERT });
|
||||
public static final Attribute<Integer> len_attr
|
||||
= Attributes.forInteger("length", __("wireLengthAttr"));
|
||||
= Attributes.forInteger("length", getFromLocale("wireLengthAttr"));
|
||||
|
||||
private static final List<Attribute<?>> ATTRIBUTES
|
||||
= Arrays.asList(new Attribute<?>[] { dir_attr, len_attr });
|
||||
|
|
|
@ -13,7 +13,6 @@ import com.cburch.logisim.data.AttributeSet;
|
|||
import com.cburch.logisim.data.Bounds;
|
||||
import com.cburch.logisim.data.Location;
|
||||
import com.cburch.logisim.util.GraphicsUtil;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
class WireFactory extends AbstractComponentFactory {
|
||||
|
@ -25,8 +24,8 @@ class WireFactory extends AbstractComponentFactory {
|
|||
public String getName() { return "Wire"; }
|
||||
|
||||
@Override
|
||||
public StringGetter getDisplayGetter() {
|
||||
return __("wireComponent");
|
||||
public String getDisplayGetter() {
|
||||
return getFromLocale("wireComponent");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,9 +9,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections15.list.UnmodifiableList;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.cburch.draw.model.CanvasObject;
|
||||
import com.cburch.draw.model.Handle;
|
||||
import com.cburch.draw.model.HandleGesture;
|
||||
|
@ -24,7 +21,7 @@ import static com.cburch.logisim.util.LocaleString.*;
|
|||
|
||||
public class AppearanceAnchor extends AppearanceElement {
|
||||
public static final Attribute<Direction> FACING
|
||||
= Attributes.forDirection("facing", __("appearanceFacingAttr"));
|
||||
= Attributes.forDirection("facing", getFromLocale("appearanceFacingAttr"));
|
||||
static final List<Attribute<?>> ATTRIBUTES
|
||||
= UnmodifiableList.decorate(Arrays.asList(new Attribute<?>[] { FACING }));
|
||||
|
||||
|
@ -56,7 +53,7 @@ public class AppearanceAnchor extends AppearanceElement {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("circuitAnchor");
|
||||
return getFromLocale("circuitAnchor");
|
||||
}
|
||||
|
||||
/*@Override
|
||||
|
|
|
@ -9,9 +9,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.collections15.list.UnmodifiableList;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.cburch.draw.model.CanvasObject;
|
||||
import com.cburch.draw.model.Handle;
|
||||
import com.cburch.draw.model.HandleGesture;
|
||||
|
@ -51,7 +48,7 @@ public class AppearancePort extends AppearanceElement {
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return _("circuitPort");
|
||||
return getFromLocale("circuitPort");
|
||||
}
|
||||
|
||||
/*@Override
|
||||
|
|
|
@ -17,7 +17,6 @@ import com.cburch.logisim.data.Location;
|
|||
import com.cburch.logisim.data.Value;
|
||||
import com.cburch.logisim.util.GraphicsUtil;
|
||||
import com.cburch.logisim.util.Icons;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import com.cburch.logisim.util.StringUtil;
|
||||
|
||||
public abstract class AbstractComponentFactory implements ComponentFactory {
|
||||
|
@ -37,7 +36,7 @@ public abstract class AbstractComponentFactory implements ComponentFactory {
|
|||
@Override
|
||||
public String getDisplayName() { return getDisplayGetter().toString(); }
|
||||
@Override
|
||||
public StringGetter getDisplayGetter() { return StringUtil.constantGetter(getName()); }
|
||||
public String getDisplayGetter() { return StringUtil.constantGetter(getName()); }
|
||||
@Override
|
||||
public abstract Component createComponent(Location loc, AttributeSet attrs);
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.cburch.logisim.data.AttributeDefaultProvider;
|
|||
import com.cburch.logisim.data.AttributeSet;
|
||||
import com.cburch.logisim.data.Bounds;
|
||||
import com.cburch.logisim.data.Location;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
/**
|
||||
* Represents a category of components that appear in a circuit. This class
|
||||
|
@ -26,7 +25,7 @@ public interface ComponentFactory extends AttributeDefaultProvider {
|
|||
|
||||
public String getName();
|
||||
public String getDisplayName();
|
||||
public StringGetter getDisplayGetter();
|
||||
public String getDisplayGetter();
|
||||
public Component createComponent(Location loc, AttributeSet attrs);
|
||||
public Bounds getOffsetBounds(AttributeSet attrs);
|
||||
public AttributeSet createAttributeSet();
|
||||
|
|
|
@ -6,8 +6,6 @@ package com.cburch.logisim.comp;
|
|||
import com.cburch.logisim.data.BitWidth;
|
||||
import com.cburch.logisim.data.Location;
|
||||
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
public class EndData {
|
||||
public static final int INPUT_ONLY = 1;
|
||||
public static final int OUTPUT_ONLY = 2;
|
||||
|
|
|
@ -7,13 +7,11 @@ import java.awt.Window;
|
|||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
public abstract class Attribute<V> {
|
||||
private String name;
|
||||
private StringGetter disp;
|
||||
private String disp;
|
||||
|
||||
public Attribute(String name, StringGetter disp) {
|
||||
public Attribute(String name, String disp) {
|
||||
this.name = name;
|
||||
this.disp = disp;
|
||||
}
|
||||
|
|
|
@ -3,20 +3,18 @@
|
|||
|
||||
package com.cburch.logisim.data;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
public class AttributeOption implements AttributeOptionInterface {
|
||||
private Object value;
|
||||
private String name;
|
||||
private StringGetter desc;
|
||||
private String desc;
|
||||
|
||||
public AttributeOption(Object value, StringGetter desc) {
|
||||
public AttributeOption(Object value, String desc) {
|
||||
this.value = value;
|
||||
this.name = value.toString();
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public AttributeOption(Object value, String name, StringGetter desc) {
|
||||
public AttributeOption(Object value, String name, String desc) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
|
|
|
@ -15,7 +15,6 @@ import javax.swing.plaf.basic.BasicComboBoxRenderer;
|
|||
import com.bric.swing.ColorPicker;
|
||||
import com.cburch.logisim.util.FontUtil;
|
||||
import com.cburch.logisim.util.JInputComponent;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import com.connectina.swing.fontchooser.JFontChooser;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
|
@ -23,13 +22,7 @@ import static com.cburch.logisim.util.LocaleString.*;
|
|||
public class Attributes {
|
||||
private Attributes() { }
|
||||
|
||||
private static class ConstantGetter implements StringGetter {
|
||||
private String str;
|
||||
public ConstantGetter(String str) { this.str = str; }
|
||||
@Override
|
||||
public String toString() { return str; }
|
||||
}
|
||||
private static StringGetter getter(String s) { return new ConstantGetter(s); }
|
||||
private static String getter(String s) { return s; }
|
||||
|
||||
//
|
||||
// methods with display name == standard name
|
||||
|
@ -91,62 +84,62 @@ public class Attributes {
|
|||
//
|
||||
// methods with internationalization support
|
||||
//
|
||||
public static Attribute<String> forString(String name, StringGetter disp) {
|
||||
public static Attribute<String> forString(String name, String disp) {
|
||||
return new StringAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static <V> Attribute<V> forOption(String name, StringGetter disp,
|
||||
public static <V> Attribute<V> forOption(String name, String disp,
|
||||
V[] vals) {
|
||||
return new OptionAttribute<V>(name, disp, vals);
|
||||
}
|
||||
|
||||
public static Attribute<Integer> forInteger(String name, StringGetter disp) {
|
||||
public static Attribute<Integer> forInteger(String name, String disp) {
|
||||
return new IntegerAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<Integer> forHexInteger(String name, StringGetter disp) {
|
||||
public static Attribute<Integer> forHexInteger(String name, String disp) {
|
||||
return new HexIntegerAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<Integer> forIntegerRange(String name, StringGetter disp,
|
||||
public static Attribute<Integer> forIntegerRange(String name, String disp,
|
||||
int start, int end) {
|
||||
return new IntegerRangeAttribute(name, disp, start, end);
|
||||
}
|
||||
|
||||
public static Attribute<Double> forDouble(String name, StringGetter disp) {
|
||||
public static Attribute<Double> forDouble(String name, String disp) {
|
||||
return new DoubleAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<Boolean> forBoolean(String name, StringGetter disp) {
|
||||
public static Attribute<Boolean> forBoolean(String name, String disp) {
|
||||
return new BooleanAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<Direction> forDirection(String name, StringGetter disp) {
|
||||
public static Attribute<Direction> forDirection(String name, String disp) {
|
||||
return new DirectionAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<BitWidth> forBitWidth(String name, StringGetter disp) {
|
||||
public static Attribute<BitWidth> forBitWidth(String name, String disp) {
|
||||
return new BitWidth.Attribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<BitWidth> forBitWidth(String name, StringGetter disp, int min, int max) {
|
||||
public static Attribute<BitWidth> forBitWidth(String name, String disp, int min, int max) {
|
||||
return new BitWidth.Attribute(name, disp, min, max);
|
||||
}
|
||||
|
||||
public static Attribute<Font> forFont(String name, StringGetter disp) {
|
||||
public static Attribute<Font> forFont(String name, String disp) {
|
||||
return new FontAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<Location> forLocation(String name, StringGetter disp) {
|
||||
public static Attribute<Location> forLocation(String name, String disp) {
|
||||
return new LocationAttribute(name, disp);
|
||||
}
|
||||
|
||||
public static Attribute<Color> forColor(String name, StringGetter disp) {
|
||||
public static Attribute<Color> forColor(String name, String disp) {
|
||||
return new ColorAttribute(name, disp);
|
||||
}
|
||||
|
||||
private static class StringAttribute extends Attribute<String> {
|
||||
private StringAttribute(String name, StringGetter disp) {
|
||||
private StringAttribute(String name, String disp) {
|
||||
super(name, disp);
|
||||
}
|
||||
|
||||
|
@ -182,7 +175,7 @@ public class Attributes {
|
|||
private static class OptionAttribute<V> extends Attribute<V> {
|
||||
private V[] vals;
|
||||
|
||||
private OptionAttribute(String name, StringGetter disp,
|
||||
private OptionAttribute(String name, String disp,
|
||||
V[] vals) {
|
||||
super(name, disp);
|
||||
this.vals = vals;
|
||||
|
@ -224,7 +217,7 @@ public class Attributes {
|
|||
}
|
||||
|
||||
private static class IntegerAttribute extends Attribute<Integer> {
|
||||
private IntegerAttribute(String name, StringGetter disp) {
|
||||
private IntegerAttribute(String name, String disp) {
|
||||
super(name, disp);
|
||||
}
|
||||
|
||||
|
@ -235,7 +228,7 @@ public class Attributes {
|
|||
}
|
||||
|
||||
private static class HexIntegerAttribute extends Attribute<Integer> {
|
||||
private HexIntegerAttribute(String name, StringGetter disp) {
|
||||
private HexIntegerAttribute(String name, String disp) {
|
||||
super(name, disp);
|
||||
}
|
||||
|
||||
|
@ -270,7 +263,7 @@ public class Attributes {
|
|||
}
|
||||
|
||||
private static class DoubleAttribute extends Attribute<Double> {
|
||||
private DoubleAttribute(String name, StringGetter disp) {
|
||||
private DoubleAttribute(String name, String disp) {
|
||||
super(name, disp);
|
||||
}
|
||||
|
||||
|
@ -283,18 +276,18 @@ public class Attributes {
|
|||
private static class BooleanAttribute extends OptionAttribute<Boolean> {
|
||||
private static Boolean[] vals = { Boolean.TRUE, Boolean.FALSE };
|
||||
|
||||
private BooleanAttribute(String name, StringGetter disp) {
|
||||
private BooleanAttribute(String name, String disp) {
|
||||
super(name, disp, vals);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDisplayString(Boolean value) {
|
||||
if (value.booleanValue()) {
|
||||
return _("booleanTrueOption");
|
||||
return getFromLocale("booleanTrueOption");
|
||||
}
|
||||
|
||||
else {
|
||||
return _("booleanFalseOption");
|
||||
return getFromLocale("booleanFalseOption");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -310,7 +303,7 @@ public class Attributes {
|
|||
Integer[] options = null;
|
||||
int start;
|
||||
int end;
|
||||
private IntegerRangeAttribute(String name, StringGetter disp, int start, int end) {
|
||||
private IntegerRangeAttribute(String name, String disp, int start, int end) {
|
||||
super(name, disp);
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
@ -361,7 +354,7 @@ public class Attributes {
|
|||
Direction.WEST,
|
||||
};
|
||||
|
||||
public DirectionAttribute(String name, StringGetter disp) {
|
||||
public DirectionAttribute(String name, String disp) {
|
||||
super(name, disp, vals);
|
||||
}
|
||||
|
||||
|
@ -377,7 +370,7 @@ public class Attributes {
|
|||
}
|
||||
|
||||
private static class FontAttribute extends Attribute<Font> {
|
||||
private FontAttribute(String name, StringGetter disp) {
|
||||
private FontAttribute(String name, String disp) {
|
||||
super(name, disp);
|
||||
}
|
||||
|
||||
|
@ -428,7 +421,7 @@ public class Attributes {
|
|||
}
|
||||
|
||||
private static class LocationAttribute extends Attribute<Location> {
|
||||
public LocationAttribute(String name, StringGetter desc) {
|
||||
public LocationAttribute(String name, String desc) {
|
||||
super(name, desc);
|
||||
}
|
||||
@Override
|
||||
|
@ -438,7 +431,7 @@ public class Attributes {
|
|||
}
|
||||
|
||||
private static class ColorAttribute extends Attribute<Color> {
|
||||
public ColorAttribute(String name, StringGetter desc) {
|
||||
public ColorAttribute(String name, String desc) {
|
||||
super(name, desc);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@ package com.cburch.logisim.data;
|
|||
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
public class BitWidth implements Comparable<BitWidth> {
|
||||
public static final BitWidth UNKNOWN = new BitWidth(0);
|
||||
public static final BitWidth ONE = new BitWidth(1);
|
||||
|
@ -17,13 +15,13 @@ public class BitWidth implements Comparable<BitWidth> {
|
|||
static class Attribute extends com.cburch.logisim.data.Attribute<BitWidth> {
|
||||
private BitWidth[] choices;
|
||||
|
||||
public Attribute(String name, StringGetter disp) {
|
||||
public Attribute(String name, String disp) {
|
||||
super(name, disp);
|
||||
ensurePrefab();
|
||||
choices = prefab;
|
||||
}
|
||||
|
||||
public Attribute(String name, StringGetter disp, int min, int max) {
|
||||
public Attribute(String name, String disp, int min, int max) {
|
||||
super(name, disp);
|
||||
choices = new BitWidth[max - min + 1];
|
||||
for (int i = 0; i < choices.length; i++) {
|
||||
|
|
|
@ -3,22 +3,21 @@
|
|||
|
||||
package com.cburch.logisim.data;
|
||||
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
public class Direction implements AttributeOptionInterface {
|
||||
public static final Direction EAST
|
||||
= new Direction("east", __("directionEastOption"),
|
||||
__("directionEastVertical"), 0);
|
||||
= new Direction("east", getFromLocale("directionEastOption"),
|
||||
getFromLocale("directionEastVertical"), 0);
|
||||
public static final Direction WEST
|
||||
= new Direction("west", __("directionWestOption"),
|
||||
__("directionWestVertical"), 1);
|
||||
= new Direction("west", getFromLocale("directionWestOption"),
|
||||
getFromLocale("directionWestVertical"), 1);
|
||||
public static final Direction NORTH
|
||||
= new Direction("north", __("directionNorthOption"),
|
||||
__("directionNorthVertical"), 2);
|
||||
= new Direction("north", getFromLocale("directionNorthOption"),
|
||||
getFromLocale("directionNorthVertical"), 2);
|
||||
public static final Direction SOUTH
|
||||
= new Direction("south", __("directionSouthOption"),
|
||||
__("directionSouthVertical"), 3);
|
||||
= new Direction("south", getFromLocale("directionSouthOption"),
|
||||
getFromLocale("directionSouthVertical"), 3);
|
||||
public static final Direction[] cardinals
|
||||
= { NORTH, EAST, SOUTH, WEST };
|
||||
|
||||
|
@ -43,11 +42,11 @@ public class Direction implements AttributeOptionInterface {
|
|||
}
|
||||
|
||||
private String name;
|
||||
private StringGetter disp;
|
||||
private StringGetter vert;
|
||||
private String disp;
|
||||
private String vert;
|
||||
private int id;
|
||||
|
||||
private Direction(String name, StringGetter disp, StringGetter vert, int id) {
|
||||
private Direction(String name, String disp, String vert, int id) {
|
||||
this.name = name;
|
||||
this.disp = disp;
|
||||
this.vert = vert;
|
||||
|
@ -64,7 +63,7 @@ public class Direction implements AttributeOptionInterface {
|
|||
return disp.toString();
|
||||
}
|
||||
|
||||
public StringGetter getDisplayGetter() {
|
||||
public String getDisplayGetter() {
|
||||
return disp;
|
||||
}
|
||||
|
||||
|
@ -78,7 +77,10 @@ public class Direction implements AttributeOptionInterface {
|
|||
}
|
||||
|
||||
public boolean equals( Direction other ) {
|
||||
return this.id == other.id;
|
||||
if (other != null) {
|
||||
return this.id == other.id;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public double toRadians() {
|
||||
|
|
|
@ -384,11 +384,11 @@ public class Value {
|
|||
}
|
||||
|
||||
if (isErrorValue()) {
|
||||
return _("valueError");
|
||||
return getFromLocale("valueError");
|
||||
}
|
||||
|
||||
if (!isFullyDefined()) {
|
||||
return _("valueUnknown");
|
||||
return getFromLocale("valueUnknown");
|
||||
}
|
||||
|
||||
|
||||
|
@ -414,11 +414,11 @@ public class Value {
|
|||
}
|
||||
|
||||
if (isErrorValue()) {
|
||||
return _("valueError");
|
||||
return getFromLocale("valueError");
|
||||
}
|
||||
|
||||
if (!isFullyDefined()) {
|
||||
return _("valueUnknown");
|
||||
return getFromLocale("valueUnknown");
|
||||
}
|
||||
|
||||
return Integer.toString(toIntValue(), radix);
|
||||
|
@ -430,11 +430,11 @@ public class Value {
|
|||
case 0: return "-";
|
||||
case 1:
|
||||
if (error != 0) {
|
||||
return _("valueErrorSymbol");
|
||||
return getFromLocale("valueErrorSymbol");
|
||||
}
|
||||
|
||||
else if (unknown != 0) {
|
||||
return _("valueUnknownSymbol");
|
||||
return getFromLocale("valueUnknownSymbol");
|
||||
}
|
||||
|
||||
else if (value != 0) {
|
||||
|
|
|
@ -135,7 +135,7 @@ class LibraryManager {
|
|||
// Otherwise we'll have to decode it.
|
||||
int sep = desc.indexOf(desc_sep);
|
||||
if (sep < 0) {
|
||||
loader.showError(_("fileDescriptorError", desc));
|
||||
loader.showError(getFromLocale("fileDescriptorError", desc));
|
||||
return null;
|
||||
}
|
||||
String type = desc.substring(0, sep);
|
||||
|
@ -144,7 +144,7 @@ class LibraryManager {
|
|||
if (type.equals("")) {
|
||||
Library ret = loader.getBuiltin().getLibrary(name);
|
||||
if (ret == null) {
|
||||
loader.showError(_("fileBuiltinMissingError", name));
|
||||
loader.showError(getFromLocale("fileBuiltinMissingError", name));
|
||||
return null;
|
||||
}
|
||||
return ret;
|
||||
|
@ -158,7 +158,7 @@ class LibraryManager {
|
|||
File toRead = loader.getFileFor(fileName, Loader.JAR_FILTER);
|
||||
return loadJarLibrary(loader, toRead, className);
|
||||
} else {
|
||||
loader.showError(_("fileTypeError",
|
||||
loader.showError(getFromLocale("fileTypeError",
|
||||
type, desc));
|
||||
return null;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class LibraryManager {
|
|||
public void reload(Loader loader, LoadedLibrary lib) {
|
||||
LibraryDescriptor descriptor = invMap.get(lib);
|
||||
if (descriptor == null) {
|
||||
loader.showError(_("unknownLibraryFileError",
|
||||
loader.showError(getFromLocale("unknownLibraryFileError",
|
||||
lib.getDisplayName()));
|
||||
} else {
|
||||
try {
|
||||
|
@ -262,7 +262,7 @@ class LibraryManager {
|
|||
if (desc != null) {
|
||||
return desc.toDescriptor(loader);
|
||||
} else {
|
||||
throw new LoaderException(_("fileDescriptorUnknownError", lib.getDisplayName()));
|
||||
throw new LoaderException(getFromLocale("fileDescriptorUnknownError", lib.getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class Loader implements LibraryLoader {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return _("logisimFileFilter");
|
||||
return getFromLocale("logisimFileFilter");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class Loader implements LibraryLoader {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return _("jarFileFilter");
|
||||
return getFromLocale("jarFileFilter");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,8 +256,8 @@ public class Loader implements LibraryLoader {
|
|||
Library reference = LibraryManager.instance.findReference(file, dest);
|
||||
if (reference != null) {
|
||||
JOptionPane.showMessageDialog(parent,
|
||||
_("fileCircularError", reference.getDisplayName()),
|
||||
_("fileSaveErrorTitle"),
|
||||
getFromLocale("fileCircularError", reference.getDisplayName()),
|
||||
getFromLocale("fileSaveErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
@ -291,9 +291,9 @@ public class Loader implements LibraryLoader {
|
|||
}
|
||||
|
||||
JOptionPane.showMessageDialog(parent,
|
||||
_("fileSaveError",
|
||||
getFromLocale("fileSaveError",
|
||||
e.toString()),
|
||||
_("fileSaveErrorTitle"),
|
||||
getFromLocale("fileSaveErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
@ -311,9 +311,9 @@ public class Loader implements LibraryLoader {
|
|||
}
|
||||
|
||||
JOptionPane.showMessageDialog(parent,
|
||||
_("fileSaveCloseError",
|
||||
getFromLocale("fileSaveCloseError",
|
||||
e.toString()),
|
||||
_("fileSaveErrorTitle"),
|
||||
getFromLocale("fileSaveErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
@ -326,8 +326,8 @@ public class Loader implements LibraryLoader {
|
|||
dest.delete();
|
||||
}
|
||||
JOptionPane.showMessageDialog(parent,
|
||||
_("fileSaveZeroError"),
|
||||
_("fileSaveErrorTitle"),
|
||||
getFromLocale("fileSaveZeroError"),
|
||||
getFromLocale("fileSaveErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
@ -385,8 +385,8 @@ public class Loader implements LibraryLoader {
|
|||
for (File fileOpening : filesOpening) {
|
||||
if (fileOpening.equals(actual)) {
|
||||
logger.error( "An error occurred when opening the file.\n"
|
||||
+ _("logisimCircularError" ) );
|
||||
throw new LoadFailedException(_("logisimCircularError",
|
||||
+ getFromLocale("logisimCircularError" ) );
|
||||
throw new LoadFailedException(getFromLocale("logisimCircularError",
|
||||
toProjectName(actual)));
|
||||
}
|
||||
}
|
||||
|
@ -397,8 +397,8 @@ public class Loader implements LibraryLoader {
|
|||
ret = LogisimFile.load(actual, this);
|
||||
} catch (IOException e) {
|
||||
logger.error( "An error occurred when opening the file.\n"
|
||||
+ _("logisimCircularError" ) );
|
||||
throw new LoadFailedException(_("logisimLoadError",
|
||||
+ getFromLocale("logisimCircularError" ) );
|
||||
throw new LoadFailedException(getFromLocale("logisimLoadError",
|
||||
toProjectName(actual), e.toString()));
|
||||
} finally {
|
||||
filesOpening.pop();
|
||||
|
@ -446,11 +446,11 @@ public class Loader implements LibraryLoader {
|
|||
retClass = loader.loadClass(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.error( "Class not found" );
|
||||
throw new LoadFailedException(_("jarClassNotFoundError", className));
|
||||
throw new LoadFailedException(getFromLocale("jarClassNotFoundError", className));
|
||||
}
|
||||
if (!(Library.class.isAssignableFrom(retClass))) {
|
||||
logger.error( "Class not library" );
|
||||
throw new LoadFailedException(_("jarClassNotLibraryError", className));
|
||||
throw new LoadFailedException(getFromLocale("jarClassNotLibraryError", className));
|
||||
}
|
||||
|
||||
// instantiate library
|
||||
|
@ -459,7 +459,7 @@ public class Loader implements LibraryLoader {
|
|||
ret = (Library) retClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
logger.error( "Class not library" );
|
||||
throw new LoadFailedException(_("jarLibraryNotCreatedError", className));
|
||||
throw new LoadFailedException(getFromLocale("jarLibraryNotCreatedError", className));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -521,10 +521,10 @@ public class Loader implements LibraryLoader {
|
|||
JScrollPane scrollPane = new JScrollPane(textArea);
|
||||
scrollPane.setPreferredSize(new Dimension(350, 150));
|
||||
JOptionPane.showMessageDialog(parent, scrollPane,
|
||||
_("fileErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
getFromLocale("fileErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(parent, description,
|
||||
_("fileErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
getFromLocale("fileErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ public class Loader implements LibraryLoader {
|
|||
String message = source.getMessage();
|
||||
while (message != null) {
|
||||
JOptionPane.showMessageDialog(parent,
|
||||
message, _("fileMessageTitle"),
|
||||
message, getFromLocale("fileMessageTitle"),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
message = source.getMessage();
|
||||
}
|
||||
|
@ -569,14 +569,14 @@ public class Loader implements LibraryLoader {
|
|||
while (!file.canRead()) {
|
||||
// It doesn't exist. Figure it out from the user.
|
||||
JOptionPane.showMessageDialog(parent,
|
||||
_("fileLibraryMissingError",
|
||||
getFromLocale("fileLibraryMissingError",
|
||||
file.getName()));
|
||||
JFileChooser chooser = createChooser();
|
||||
chooser.setFileFilter(filter);
|
||||
chooser.setDialogTitle(_("fileLibraryMissingTitle", file.getName()));
|
||||
int action = chooser.showDialog(parent, _("fileLibraryMissingButton"));
|
||||
chooser.setDialogTitle(getFromLocale("fileLibraryMissingTitle", file.getName()));
|
||||
int action = chooser.showDialog(parent, getFromLocale("fileLibraryMissingButton"));
|
||||
if (action != JFileChooser.APPROVE_OPTION) {
|
||||
throw new LoaderException(_("fileLoadCanceledError"));
|
||||
throw new LoaderException(getFromLocale("fileLoadCanceledError"));
|
||||
}
|
||||
file = chooser.getSelectedFile();
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
try {
|
||||
file.write(out, file.loader);
|
||||
} catch (IOException e) {
|
||||
file.loader.showError(_("fileDuplicateError", e.toString()));
|
||||
file.loader.showError(getFromLocale("fileDuplicateError", e.toString()));
|
||||
}
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
file.loader.showError(_("fileDuplicateError", e.toString()));
|
||||
file.loader.showError(getFromLocale("fileDuplicateError", e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
LogisimFile(Loader loader) {
|
||||
this.loader = loader;
|
||||
|
||||
name = _("defaultProjectName");
|
||||
name = getFromLocale("defaultProjectName");
|
||||
if (Projects.windowNamed(name)) {
|
||||
for (int i = 2; true; i++) {
|
||||
if (!Projects.windowNamed(name + " " + i)) {
|
||||
|
@ -278,7 +278,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
for (Circuit circuit : getCircuits()) {
|
||||
for (Component comp : circuit.getNonWires()) {
|
||||
if (factories.contains(comp.getFactory())) {
|
||||
return _("unloadUsedError",
|
||||
return getFromLocale("unloadUsedError",
|
||||
circuit.getName());
|
||||
}
|
||||
}
|
||||
|
@ -288,10 +288,10 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
MouseMappings mm = options.getMouseMappings();
|
||||
for (Tool t : lib.getTools()) {
|
||||
if (tb.usesToolFromSource(t)) {
|
||||
return _("unloadToolbarError");
|
||||
return getFromLocale("unloadToolbarError");
|
||||
}
|
||||
if (mm.usesToolFromSource(t)) {
|
||||
return _("unloadMappingError");
|
||||
return getFromLocale("unloadMappingError");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
loader.showError("internal error configuring parser");
|
||||
} catch (TransformerException e) {
|
||||
String msg = e.getMessage();
|
||||
String err = _("xmlConversionError");
|
||||
String err = getFromLocale("xmlConversionError");
|
||||
if (msg == null) {
|
||||
err += ": " + msg;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
try {
|
||||
reader.connect(writer);
|
||||
} catch (IOException e) {
|
||||
newloader.showError(_("fileDuplicateError", e.toString()));
|
||||
newloader.showError(getFromLocale("fileDuplicateError", e.toString()));
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e1) {
|
||||
|
@ -345,7 +345,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
try {
|
||||
return LogisimFile.load(reader, newloader);
|
||||
} catch (IOException e) {
|
||||
newloader.showError(_("fileDuplicateError", e.toString()));
|
||||
newloader.showError(getFromLocale("fileDuplicateError", e.toString()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
in = new ReaderInputStream(new FileReader(file), "UTF8");
|
||||
return loadSub(in, loader);
|
||||
} catch (Exception t) {
|
||||
loader.showError(_("xmlFormatError", firstExcept.toString()));
|
||||
loader.showError(getFromLocale("xmlFormatError", firstExcept.toString()));
|
||||
} finally {
|
||||
try {
|
||||
in.close();
|
||||
|
@ -418,7 +418,7 @@ public class LogisimFile extends Library implements LibraryEventSource {
|
|||
try {
|
||||
return loadSub(in, loader);
|
||||
} catch (SAXException e) {
|
||||
loader.showError(_("xmlFormatError", e.toString()));
|
||||
loader.showError(getFromLocale("xmlFormatError", e.toString()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class LogisimFileActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("addCircuitAction");
|
||||
return getFromLocale("addCircuitAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,7 +89,7 @@ public class LogisimFileActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("removeCircuitAction");
|
||||
return getFromLocale("removeCircuitAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class LogisimFileActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("moveCircuitAction");
|
||||
return getFromLocale("moveCircuitAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,9 +154,9 @@ public class LogisimFileActions {
|
|||
@Override
|
||||
public String getName() {
|
||||
if (libs.length == 1) {
|
||||
return _("loadLibraryAction");
|
||||
return getFromLocale("loadLibraryAction");
|
||||
} else {
|
||||
return _("loadLibrariesAction");
|
||||
return getFromLocale("loadLibrariesAction");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,9 +185,9 @@ public class LogisimFileActions {
|
|||
@Override
|
||||
public String getName() {
|
||||
if (libs.length == 1) {
|
||||
return _("unloadLibraryAction");
|
||||
return getFromLocale("unloadLibraryAction");
|
||||
} else {
|
||||
return _("unloadLibrariesAction");
|
||||
return getFromLocale("unloadLibrariesAction");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class LogisimFileActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("setMainCircuitAction");
|
||||
return getFromLocale("setMainCircuitAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -255,7 +255,7 @@ public class LogisimFileActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("revertDefaultsAction");
|
||||
return getFromLocale("revertDefaultsAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,16 +12,16 @@ import static com.cburch.logisim.util.LocaleString.*;
|
|||
|
||||
public class Options {
|
||||
public static final AttributeOption GATE_UNDEFINED_IGNORE
|
||||
= new AttributeOption("ignore", __("gateUndefinedIgnore"));
|
||||
= new AttributeOption("ignore", getFromLocale("gateUndefinedIgnore"));
|
||||
public static final AttributeOption GATE_UNDEFINED_ERROR
|
||||
= new AttributeOption("error", __("gateUndefinedError"));
|
||||
= new AttributeOption("error", getFromLocale("gateUndefinedError"));
|
||||
|
||||
public static final Attribute<Integer> sim_limit_attr
|
||||
= Attributes.forInteger("simlimit", __("simLimitOption"));
|
||||
= Attributes.forInteger("simlimit", getFromLocale("simLimitOption"));
|
||||
public static final Attribute<Integer> sim_rand_attr
|
||||
= Attributes.forInteger("simrand", __("simRandomOption"));
|
||||
= Attributes.forInteger("simrand", getFromLocale("simRandomOption"));
|
||||
public static final Attribute<AttributeOption> ATTR_GATE_UNDEFINED
|
||||
= Attributes.forOption("gateUndefined", __("gateUndefinedOption"),
|
||||
= Attributes.forOption("gateUndefined", getFromLocale("gateUndefinedOption"),
|
||||
new AttributeOption[] { GATE_UNDEFINED_IGNORE, GATE_UNDEFINED_ERROR });
|
||||
|
||||
public static final Integer sim_rand_dflt = Integer.valueOf(32);
|
||||
|
|
|
@ -110,22 +110,22 @@ public class XmlCircuitReader extends CircuitTransaction {
|
|||
try {
|
||||
String str = elt.getAttribute("from");
|
||||
if (str == null || str.equals("")) {
|
||||
throw new XmlReaderException(_("wireStartMissingError"));
|
||||
throw new XmlReaderException(getFromLocale("wireStartMissingError"));
|
||||
}
|
||||
pt0 = Location.parse(str);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new XmlReaderException(_("wireStartInvalidError"));
|
||||
throw new XmlReaderException(getFromLocale("wireStartInvalidError"));
|
||||
}
|
||||
|
||||
Location pt1;
|
||||
try {
|
||||
String str = elt.getAttribute("to");
|
||||
if (str == null || str.equals("")) {
|
||||
throw new XmlReaderException(_("wireEndMissingError"));
|
||||
throw new XmlReaderException(getFromLocale("wireEndMissingError"));
|
||||
}
|
||||
pt1 = Location.parse(str);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new XmlReaderException(_("wireEndInvalidError"));
|
||||
throw new XmlReaderException(getFromLocale("wireEndInvalidError"));
|
||||
}
|
||||
|
||||
mutator.add(dest, Wire.create(pt0, pt1));
|
||||
|
@ -136,21 +136,21 @@ public class XmlCircuitReader extends CircuitTransaction {
|
|||
// Determine the factory that creates this element
|
||||
String name = elt.getAttribute("name");
|
||||
if (name == null || name.equals("")) {
|
||||
throw new XmlReaderException(_("compNameMissingError"));
|
||||
throw new XmlReaderException(getFromLocale("compNameMissingError"));
|
||||
}
|
||||
|
||||
String libName = elt.getAttribute("lib");
|
||||
Library lib = reader.findLibrary(libName);
|
||||
if (lib == null) {
|
||||
throw new XmlReaderException(_("compUnknownError", "no-lib"));
|
||||
throw new XmlReaderException(getFromLocale("compUnknownError", "no-lib"));
|
||||
}
|
||||
|
||||
Tool tool = lib.getTool(name);
|
||||
if (tool == null || !(tool instanceof AddTool)) {
|
||||
if (libName == null || libName.equals("")) {
|
||||
throw new XmlReaderException(_("compUnknownError", name));
|
||||
throw new XmlReaderException(getFromLocale("compUnknownError", name));
|
||||
} else {
|
||||
throw new XmlReaderException(_("compAbsentError", name, libName));
|
||||
throw new XmlReaderException(getFromLocale("compAbsentError", name, libName));
|
||||
}
|
||||
}
|
||||
ComponentFactory source = ((AddTool) tool).getFactory();
|
||||
|
@ -162,13 +162,13 @@ public class XmlCircuitReader extends CircuitTransaction {
|
|||
|
||||
// Create component if location known
|
||||
if (loc_str == null || loc_str.equals("")) {
|
||||
throw new XmlReaderException(_("compLocMissingError", source.getName()));
|
||||
throw new XmlReaderException(getFromLocale("compLocMissingError", source.getName()));
|
||||
} else {
|
||||
try {
|
||||
Location loc = Location.parse(loc_str);
|
||||
return source.createComponent(loc, attrs);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new XmlReaderException(_("compLocInvalidError",
|
||||
throw new XmlReaderException(getFromLocale("compLocInvalidError",
|
||||
source.getName(), loc_str));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class XmlReader {
|
|||
for (Element circElt : XmlIterator.forChildElements(elt, "circuit")) {
|
||||
String name = circElt.getAttribute("name");
|
||||
if (name == null || name.equals("")) {
|
||||
addError(_("circNameMissingError"), "C??");
|
||||
addError(getFromLocale("circNameMissingError"), "C??");
|
||||
}
|
||||
CircuitData circData = new CircuitData(circElt, new Circuit(name));
|
||||
file.addCircuit(circData.circuit);
|
||||
|
@ -138,11 +138,11 @@ class XmlReader {
|
|||
|
||||
private Library toLibrary(Element elt) {
|
||||
if (!elt.hasAttribute("name")) {
|
||||
loader.showError(_("libNameMissingError"));
|
||||
loader.showError(getFromLocale("libNameMissingError"));
|
||||
return null;
|
||||
}
|
||||
if (!elt.hasAttribute("desc")) {
|
||||
loader.showError(_("libDescMissingError"));
|
||||
loader.showError(getFromLocale("libDescMissingError"));
|
||||
return null;
|
||||
}
|
||||
String name = elt.getAttribute("name");
|
||||
|
@ -155,7 +155,7 @@ class XmlReader {
|
|||
libs.put(name, ret);
|
||||
for (Element sub_elt : XmlIterator.forChildElements(elt, "tool")) {
|
||||
if (!sub_elt.hasAttribute("name")) {
|
||||
loader.showError(_("toolNameMissingError"));
|
||||
loader.showError(getFromLocale("toolNameMissingError"));
|
||||
} else {
|
||||
String tool_str = sub_elt.getAttribute("name");
|
||||
Tool tool = ret.getTool(tool_str);
|
||||
|
@ -197,13 +197,13 @@ class XmlReader {
|
|||
try {
|
||||
AbstractCanvasObject m = AppearanceSvgReader.createShape(sub, pins);
|
||||
if (m == null) {
|
||||
addError(_("fileAppearanceNotFound", sub.getTagName()),
|
||||
addError(getFromLocale("fileAppearanceNotFound", sub.getTagName()),
|
||||
context + "." + sub.getTagName());
|
||||
} else {
|
||||
shapes.add(m);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
addError(_("fileAppearanceError", sub.getTagName()),
|
||||
addError(getFromLocale("fileAppearanceError", sub.getTagName()),
|
||||
context + "." + sub.getTagName());
|
||||
}
|
||||
}
|
||||
|
@ -229,14 +229,14 @@ class XmlReader {
|
|||
|
||||
String mods_str = sub_elt.getAttribute("map");
|
||||
if (mods_str == null || mods_str.equals("")) {
|
||||
loader.showError(_("mappingMissingError"));
|
||||
loader.showError(getFromLocale("mappingMissingError"));
|
||||
continue;
|
||||
}
|
||||
int mods;
|
||||
try {
|
||||
mods = InputEventUtil.fromString(mods_str);
|
||||
} catch (NumberFormatException e) {
|
||||
loader.showError(_("mappingBadError", mods_str));
|
||||
loader.showError(getFromLocale("mappingBadError", mods_str));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -281,11 +281,11 @@ class XmlReader {
|
|||
Library lib = findLibrary(elt.getAttribute("lib"));
|
||||
String name = elt.getAttribute("name");
|
||||
if (name == null || name.equals("")) {
|
||||
throw new XmlReaderException(_("toolNameMissing"));
|
||||
throw new XmlReaderException(getFromLocale("toolNameMissing"));
|
||||
}
|
||||
Tool tool = lib.getTool(name);
|
||||
if (tool == null) {
|
||||
throw new XmlReaderException(_("toolNotFound"));
|
||||
throw new XmlReaderException(getFromLocale("toolNotFound"));
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ class XmlReader {
|
|||
messages = new ArrayList<String>();
|
||||
}
|
||||
|
||||
messages.add(_("attrNameMissingError"));
|
||||
messages.add(getFromLocale("attrNameMissingError"));
|
||||
} else {
|
||||
String attrName = attrElt.getAttribute("name");
|
||||
String attrVal;
|
||||
|
@ -351,7 +351,7 @@ class XmlReader {
|
|||
messages = new ArrayList<String>();
|
||||
}
|
||||
|
||||
messages.add(_("attrValueInvalidError",
|
||||
messages.add(getFromLocale("attrValueInvalidError",
|
||||
attrVal, attrName));
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ class XmlReader {
|
|||
|
||||
Library ret = libs.get(lib_name);
|
||||
if (ret == null) {
|
||||
throw new XmlReaderException(_("libMissingError", lib_name));
|
||||
throw new XmlReaderException(getFromLocale("libMissingError", lib_name));
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ public class AppearanceEditHandler extends EditHandler
|
|||
}
|
||||
|
||||
canvas.getProject().doAction(new SelectionAction(canvas,
|
||||
__("pasteClipboardAction"), null, add, add,
|
||||
getFromLocale("pasteClipboardAction"), null, add, add,
|
||||
anchorLocation, clip.getAnchorFacing()));
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ public class AppearanceEditHandler extends EditHandler
|
|||
|
||||
if (!remove.isEmpty()) {
|
||||
canvas.getProject().doAction(new SelectionAction(canvas,
|
||||
__("deleteSelectionAction"), remove, null, select,
|
||||
getFromLocale("deleteSelectionAction"), remove, null, select,
|
||||
anchorLocation, anchorFacing));
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public class AppearanceEditHandler extends EditHandler
|
|||
|
||||
if (!clones.isEmpty()) {
|
||||
canvas.getProject().doAction(new SelectionAction(canvas,
|
||||
__("duplicateSelectionAction"), null, clones, select,
|
||||
getFromLocale("duplicateSelectionAction"), null, clones, select,
|
||||
null, null));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,9 @@ public class ClipboardActions extends Action {
|
|||
@Override
|
||||
public String getName() {
|
||||
if (remove) {
|
||||
return _("cutSelectionAction");
|
||||
return getFromLocale("cutSelectionAction");
|
||||
} else {
|
||||
return _("copySelectionAction");
|
||||
return getFromLocale("copySelectionAction");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class RevertAppearanceAction extends Action {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("revertAppearanceAction");
|
||||
return getFromLocale("revertAppearanceAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,10 +16,9 @@ import com.cburch.logisim.data.Direction;
|
|||
import com.cburch.logisim.data.Location;
|
||||
import com.cburch.logisim.proj.Action;
|
||||
import com.cburch.logisim.proj.Project;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
class SelectionAction extends Action {
|
||||
private StringGetter displayName;
|
||||
private String displayName;
|
||||
private AppearanceCanvas canvas;
|
||||
private CanvasModel canvasModel;
|
||||
private Map<CanvasObject, Integer> toRemove;
|
||||
|
@ -31,7 +30,7 @@ class SelectionAction extends Action {
|
|||
private Location anchorOldLocation;
|
||||
private Direction anchorOldFacing;
|
||||
|
||||
public SelectionAction(AppearanceCanvas canvas, StringGetter displayName,
|
||||
public SelectionAction(AppearanceCanvas canvas, String displayName,
|
||||
Collection<CanvasObject> toRemove, Collection<CanvasObject> toAdd,
|
||||
Collection<CanvasObject> newSelection, Location anchorLocation,
|
||||
Direction anchorFacing) {
|
||||
|
|
|
@ -73,12 +73,12 @@ public class AttrTable extends JPanel implements LocaleListener {
|
|||
Object value;
|
||||
|
||||
public MyDialog(Dialog parent, JInputComponent input) {
|
||||
super(parent, _("attributeDialogTitle"), true);
|
||||
super(parent, getFromLocale("attributeDialogTitle"), true);
|
||||
configure(input);
|
||||
}
|
||||
|
||||
public MyDialog(Frame parent, JInputComponent input) {
|
||||
super(parent, _("attributeDialogTitle"), true);
|
||||
super(parent, getFromLocale("attributeDialogTitle"), true);
|
||||
configure(input);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class AttrTable extends JPanel implements LocaleListener {
|
|||
attrModel.getRow(rowIndex).setValue(value);
|
||||
} catch (AttrTableSetException e) {
|
||||
JOptionPane.showMessageDialog(parent, e.getMessage(),
|
||||
_("attributeChangeInvalidTitle"),
|
||||
getFromLocale("attributeChangeInvalidTitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ public class AttrTable extends JPanel implements LocaleListener {
|
|||
row.setValue(retval);
|
||||
} catch (AttrTableSetException e) {
|
||||
JOptionPane.showMessageDialog(parent, e.getMessage(),
|
||||
_("attributeChangeInvalidTitle"),
|
||||
getFromLocale("attributeChangeInvalidTitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
editor = new JLabel(row.getValue());
|
||||
|
|
|
@ -70,11 +70,11 @@ public abstract class AttributeSetTableModel
|
|||
}
|
||||
setValueRequested(attr, value);
|
||||
} catch (ClassCastException e) {
|
||||
String msg = _("attributeChangeInvalidError")
|
||||
String msg = getFromLocale("attributeChangeInvalidError")
|
||||
+ ": " + e;
|
||||
throw new AttrTableSetException(msg);
|
||||
} catch (NumberFormatException e) {
|
||||
String msg = _("attributeChangeInvalidError");
|
||||
String msg = getFromLocale("attributeChangeInvalidError");
|
||||
String emsg = e.getMessage();
|
||||
if (emsg != null && emsg.length() > 0) {
|
||||
msg += ": " + emsg;
|
||||
|
|
|
@ -7,15 +7,22 @@ import java.awt.BorderLayout;
|
|||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
import javax.swing.AbstractSpinnerModel;
|
||||
import javax.swing.ActionMap;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import com.cburch.logisim.util.CustomAction;
|
||||
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
@ -43,7 +50,7 @@ public class ZoomControl extends JPanel {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
double zoom = model.getZoomFactor();
|
||||
|
@ -92,7 +99,7 @@ public class ZoomControl extends JPanel {
|
|||
|
||||
@Override
|
||||
public String getToolTipText(MouseEvent e) {
|
||||
return _("zoomShowGrid");
|
||||
return getFromLocale("zoomShowGrid");
|
||||
}
|
||||
|
||||
private void update() {
|
||||
|
@ -143,6 +150,14 @@ public class ZoomControl extends JPanel {
|
|||
private SpinnerModel spinnerModel;
|
||||
private GridIcon grid;
|
||||
|
||||
public void zoomIn() {
|
||||
spinnerModel.setValue(spinnerModel.getNextValue());
|
||||
}
|
||||
|
||||
public void zoomOut() {
|
||||
spinnerModel.setValue(spinnerModel.getPreviousValue());
|
||||
}
|
||||
|
||||
public ZoomControl(ZoomModel model) {
|
||||
super(new BorderLayout());
|
||||
this.model = model;
|
||||
|
@ -150,6 +165,20 @@ public class ZoomControl extends JPanel {
|
|||
spinnerModel = new SpinnerModel();
|
||||
spinner = new JSpinner();
|
||||
spinner.setModel(spinnerModel);
|
||||
|
||||
//Zooming with CTRL+/-
|
||||
InputMap im = this.getInputMap(ZoomControl.WHEN_IN_FOCUSED_WINDOW);
|
||||
ActionMap am = this.getActionMap();
|
||||
int mask = getToolkit().getMenuShortcutKeyMask();
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, mask), "CTRL+");
|
||||
am.put("CTRL+", new CustomAction("CTRL+", this));
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, mask), "CTRL+");
|
||||
am.put("CTRL+", new CustomAction("CTRL+", this));
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, mask), "CTRL-");
|
||||
am.put("CTRL-", new CustomAction("CTRL-", this));
|
||||
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, mask), "CTRL-");
|
||||
am.put("CTRL-", new CustomAction("CTRL-", this));
|
||||
|
||||
this.add(spinner, BorderLayout.CENTER);
|
||||
|
||||
grid = new GridIcon();
|
||||
|
|
|
@ -131,15 +131,15 @@ class Clip implements ClipboardOwner {
|
|||
} catch (IOException e) {
|
||||
JOptionPane.showMessageDialog(editor.getRootPane(),
|
||||
e.getMessage(),
|
||||
// _("hexPasteSupportedError"),
|
||||
_("hexPasteErrorTitle"),
|
||||
// getFromLocale("hexPasteSupportedError"),
|
||||
getFromLocale("hexPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(editor.getRootPane(),
|
||||
_("hexPasteSupportedError"),
|
||||
_("hexPasteErrorTitle"),
|
||||
getFromLocale("hexPasteSupportedError"),
|
||||
getFromLocale("hexPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ class Clip implements ClipboardOwner {
|
|||
model.set(p0, data);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(editor.getRootPane(),
|
||||
_("hexPasteEndError"),
|
||||
_("hexPasteErrorTitle"),
|
||||
getFromLocale("hexPasteEndError"),
|
||||
getFromLocale("hexPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
|
@ -172,8 +172,8 @@ class Clip implements ClipboardOwner {
|
|||
model.set(p0, data);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(editor.getRootPane(),
|
||||
_("hexPasteSizeError"),
|
||||
_("hexPasteErrorTitle"),
|
||||
getFromLocale("hexPasteSizeError"),
|
||||
getFromLocale("hexPasteErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class HexFile {
|
|||
leftValue = Long.parseLong(tok.substring(star + 1), 16);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IOException(_("hexNumberFormatError"));
|
||||
throw new IOException(getFromLocale("hexNumberFormatError"));
|
||||
}
|
||||
|
||||
int n = (int) Math.min(data.length - pos, leftCount);
|
||||
|
@ -141,7 +141,7 @@ public class HexFile {
|
|||
if (cur != start + 1) out.write((cur - start) + "*");
|
||||
out.write(Integer.toHexString(val));
|
||||
} catch (IOException e) {
|
||||
throw new IOException(_("hexFileWriteError"));
|
||||
throw new IOException(getFromLocale("hexFileWriteError"));
|
||||
}
|
||||
tokens++;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class HexFile {
|
|||
while (reader.hasNext()) {
|
||||
int[] values = reader.next();
|
||||
if (offs + values.length - 1 > dst.getLastOffset()) {
|
||||
throw new IOException(_("hexFileSizeError"));
|
||||
throw new IOException(getFromLocale("hexFileSizeError"));
|
||||
}
|
||||
dst.set(offs, values);
|
||||
offs += values.length;
|
||||
|
@ -189,12 +189,12 @@ public class HexFile {
|
|||
try {
|
||||
in = new BufferedReader(new FileReader(src));
|
||||
} catch (IOException e) {
|
||||
throw new IOException(_("hexFileOpenError"));
|
||||
throw new IOException(getFromLocale("hexFileOpenError"));
|
||||
}
|
||||
try {
|
||||
String header = in.readLine();
|
||||
if (!header.equals(RAW_IMAGE_HEADER)) {
|
||||
throw new IOException(_("hexHeaderFormatError"));
|
||||
throw new IOException(getFromLocale("hexHeaderFormatError"));
|
||||
}
|
||||
open(dst, in);
|
||||
try {
|
||||
|
@ -202,7 +202,7 @@ public class HexFile {
|
|||
in = null;
|
||||
oldIn.close();
|
||||
} catch (IOException e) {
|
||||
throw new IOException(_("hexFileReadError"));
|
||||
throw new IOException(getFromLocale("hexFileReadError"));
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
|
@ -216,20 +216,20 @@ public class HexFile {
|
|||
try {
|
||||
out = new FileWriter(dst);
|
||||
} catch (IOException e) {
|
||||
throw new IOException(_("hexFileOpenError"));
|
||||
throw new IOException(getFromLocale("hexFileOpenError"));
|
||||
}
|
||||
try {
|
||||
try {
|
||||
out.write(RAW_IMAGE_HEADER + "\n");
|
||||
} catch (IOException e) {
|
||||
throw new IOException(_("hexFileWriteError"));
|
||||
throw new IOException(getFromLocale("hexFileWriteError"));
|
||||
}
|
||||
save(out, src);
|
||||
} finally {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
throw new IOException(_("hexFileWriteError"));
|
||||
throw new IOException(getFromLocale("hexFileWriteError"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class HexFrame extends LFrame {
|
|||
private class WindowMenuManager extends WindowMenuItemManager
|
||||
implements LocaleListener {
|
||||
WindowMenuManager() {
|
||||
super(_("hexFrameMenuItem"), false);
|
||||
super(getFromLocale("hexFrameMenuItem"), false);
|
||||
LocaleManager.addLocaleListener(this);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class HexFrame extends LFrame {
|
|||
|
||||
@Override
|
||||
public void localeChanged() {
|
||||
setText(_("hexFrameMenuItem"));
|
||||
setText(getFromLocale("hexFrameMenuItem"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class HexFrame extends LFrame {
|
|||
Object src = event.getSource();
|
||||
if (src == open) {
|
||||
JFileChooser chooser = JFileChoosers.createSelected(lastFile);
|
||||
chooser.setDialogTitle(_("openButton"));
|
||||
chooser.setDialogTitle(getFromLocale("openButton"));
|
||||
int choice = chooser.showOpenDialog(HexFrame.this);
|
||||
if (choice == JFileChooser.APPROVE_OPTION) {
|
||||
File f = chooser.getSelectedFile();
|
||||
|
@ -71,12 +71,12 @@ public class HexFrame extends LFrame {
|
|||
lastFile = f;
|
||||
} catch (IOException e) {
|
||||
JOptionPane.showMessageDialog(HexFrame.this, e.getMessage(),
|
||||
_("hexOpenErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
getFromLocale("hexOpenErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
} else if (src == save) {
|
||||
JFileChooser chooser = JFileChoosers.createSelected(lastFile);
|
||||
chooser.setDialogTitle(_("saveButton"));
|
||||
chooser.setDialogTitle(getFromLocale("saveButton"));
|
||||
int choice = chooser.showSaveDialog(HexFrame.this);
|
||||
if (choice == JFileChooser.APPROVE_OPTION) {
|
||||
File f = chooser.getSelectedFile();
|
||||
|
@ -85,7 +85,7 @@ public class HexFrame extends LFrame {
|
|||
lastFile = f;
|
||||
} catch (IOException e) {
|
||||
JOptionPane.showMessageDialog(HexFrame.this, e.getMessage(),
|
||||
_("hexSaveErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
getFromLocale("hexSaveErrorTitle"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
} else if (src == close) {
|
||||
|
@ -97,10 +97,10 @@ public class HexFrame extends LFrame {
|
|||
|
||||
@Override
|
||||
public void localeChanged() {
|
||||
setTitle(_("hexFrameTitle"));
|
||||
open.setText(_("openButton"));
|
||||
save.setText(_("saveButton"));
|
||||
close.setText(_("closeButton"));
|
||||
setTitle(getFromLocale("hexFrameTitle"));
|
||||
open.setText(getFromLocale("openButton"));
|
||||
save.setText(getFromLocale("saveButton"));
|
||||
close.setText(getFromLocale("closeButton"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ class FilePanel extends LogPanel {
|
|||
|
||||
private void computeEnableItems(Model model) {
|
||||
if (model.isFileEnabled()) {
|
||||
enableLabel.setText(_("fileEnabled"));
|
||||
enableButton.setText(_("fileDisableButton"));
|
||||
enableLabel.setText(getFromLocale("fileEnabled"));
|
||||
enableButton.setText(getFromLocale("fileDisableButton"));
|
||||
} else {
|
||||
enableLabel.setText(_("fileDisabled"));
|
||||
enableButton.setText(_("fileEnableButton"));
|
||||
enableLabel.setText(getFromLocale("fileDisabled"));
|
||||
enableButton.setText(getFromLocale("fileEnableButton"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,20 +69,20 @@ class FilePanel extends LogPanel {
|
|||
File file = chooser.getSelectedFile();
|
||||
if (file.exists() && (!file.canWrite() || file.isDirectory())) {
|
||||
JOptionPane.showMessageDialog(getLogFrame(),
|
||||
_("fileCannotWriteMessage", file.getName()),
|
||||
_("fileCannotWriteTitle"),
|
||||
getFromLocale("fileCannotWriteMessage", file.getName()),
|
||||
getFromLocale("fileCannotWriteTitle"),
|
||||
JOptionPane.OK_OPTION);
|
||||
return;
|
||||
}
|
||||
if (file.exists() && file.length() > 0) {
|
||||
String[] options = {
|
||||
_("fileOverwriteOption"),
|
||||
_("fileAppendOption"),
|
||||
_("fileCancelOption"),
|
||||
getFromLocale("fileOverwriteOption"),
|
||||
getFromLocale("fileAppendOption"),
|
||||
getFromLocale("fileCancelOption"),
|
||||
};
|
||||
int option = JOptionPane.showOptionDialog(getLogFrame(),
|
||||
_("fileExistsMessage", file.getName()),
|
||||
_("fileExistsTitle"),
|
||||
getFromLocale("fileExistsMessage", file.getName()),
|
||||
getFromLocale("fileExistsTitle"),
|
||||
0, JOptionPane.QUESTION_MESSAGE, null,
|
||||
options, options[0]);
|
||||
if (option == 0) {
|
||||
|
@ -157,20 +157,20 @@ class FilePanel extends LogPanel {
|
|||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return _("fileTab");
|
||||
return getFromLocale("fileTab");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return _("fileHelp");
|
||||
return getFromLocale("fileHelp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void localeChanged() {
|
||||
listener.computeEnableItems(getModel());
|
||||
fileLabel.setText(_("fileLabel") + " ");
|
||||
selectButton.setText(_("fileSelectButton"));
|
||||
headerCheckBox.setText(_("fileHeaderCheck"));
|
||||
fileLabel.setText(getFromLocale("fileLabel") + " ");
|
||||
selectButton.setText(getFromLocale("fileSelectButton"));
|
||||
headerCheckBox.setText(getFromLocale("fileHeaderCheck"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,7 @@ public class LogFrame extends LFrame {
|
|||
private class WindowMenuManager extends WindowMenuItemManager
|
||||
implements LocaleListener, ProjectListener, LibraryListener {
|
||||
WindowMenuManager() {
|
||||
super(_("logFrameMenuItem"), false);
|
||||
super(getFromLocale("logFrameMenuItem"), false);
|
||||
project.addProjectListener(this);
|
||||
project.addLibraryListener(this);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class LogFrame extends LFrame {
|
|||
@Override
|
||||
public void localeChanged() {
|
||||
String title = project.getLogisimFile().getDisplayName();
|
||||
setText(_("logFrameMenuItem", title));
|
||||
setText(getFromLocale("logFrameMenuItem", title));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,7 +111,7 @@ public class LogFrame extends LFrame {
|
|||
tabbedPane.setToolTipTextAt(i, panels[i].getToolTipText());
|
||||
panels[i].localeChanged();
|
||||
}
|
||||
close.setText(_("closeButton"));
|
||||
close.setText(getFromLocale("closeButton"));
|
||||
windowManager.localeChanged();
|
||||
}
|
||||
|
||||
|
@ -242,6 +242,6 @@ public class LogFrame extends LFrame {
|
|||
|
||||
private static String computeTitle(Model data, Project proj) {
|
||||
String name = data == null ? "???" : data.getCircuitState().getCircuit().getName();
|
||||
return _("logFrameTitle", name, proj.getLogisimFile().getDisplayName());
|
||||
return getFromLocale("logFrameTitle", name, proj.getLogisimFile().getDisplayName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,21 +177,21 @@ class SelectionPanel extends LogPanel {
|
|||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return _("selectionTab");
|
||||
return getFromLocale("selectionTab");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return _("selectionHelp");
|
||||
return getFromLocale("selectionHelp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void localeChanged() {
|
||||
addTool.setText(_("selectionAdd"));
|
||||
changeBase.setText(_("selectionChangeBase"));
|
||||
moveUp.setText(_("selectionMoveUp"));
|
||||
moveDown.setText(_("selectionMoveDown"));
|
||||
remove.setText(_("selectionRemove"));
|
||||
addTool.setText(getFromLocale("selectionAdd"));
|
||||
changeBase.setText(getFromLocale("selectionChangeBase"));
|
||||
moveUp.setText(getFromLocale("selectionMoveUp"));
|
||||
moveDown.setText(getFromLocale("selectionMoveDown"));
|
||||
remove.setText(getFromLocale("selectionRemove"));
|
||||
selector.localeChanged();
|
||||
list.localeChanged();
|
||||
}
|
||||
|
|
|
@ -139,12 +139,12 @@ class TablePanel extends LogPanel {
|
|||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return _("tableTab");
|
||||
return getFromLocale("tableTab");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return _("tableHelp");
|
||||
return getFromLocale("tableHelp");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -202,7 +202,7 @@ class TablePanel extends LogPanel {
|
|||
int columns = sel.size();
|
||||
if (columns == 0) {
|
||||
g.setFont(BODY_FONT);
|
||||
GraphicsUtil.drawCenteredText(g, _("tableEmptyMessage"), sz.width / 2, sz.height / 2);
|
||||
GraphicsUtil.drawCenteredText(g, getFromLocale("tableEmptyMessage"), sz.width / 2, sz.height / 2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,19 +23,19 @@ public class AttrTableCircuitModel extends AttributeSetTableModel {
|
|||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return _("circuitAttrTitle", circ.getName());
|
||||
return getFromLocale("circuitAttrTitle", circ.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueRequested(Attribute<Object> attr, Object value)
|
||||
throws AttrTableSetException {
|
||||
if (!proj.getLogisimFile().contains(circ)) {
|
||||
String msg = _("cannotModifyCircuitError");
|
||||
String msg = getFromLocale("cannotModifyCircuitError");
|
||||
throw new AttrTableSetException(msg);
|
||||
} else {
|
||||
CircuitMutation xn = new CircuitMutation(circ);
|
||||
xn.setForCircuit(attr, value);
|
||||
proj.doAction(xn.toAction(__("changeCircuitAttrAction")));
|
||||
proj.doAction(xn.toAction(getFromLocale("changeCircuitAttrAction")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ class AttrTableComponentModel extends AttributeSetTableModel {
|
|||
public void setValueRequested(Attribute<Object> attr, Object value)
|
||||
throws AttrTableSetException {
|
||||
if (!proj.getLogisimFile().contains(circ)) {
|
||||
String msg = _("cannotModifyCircuitError");
|
||||
String msg = getFromLocale("cannotModifyCircuitError");
|
||||
throw new AttrTableSetException(msg);
|
||||
} else {
|
||||
SetAttributeAction act = new SetAttributeAction(circ,
|
||||
__("changeAttributeAction"));
|
||||
getFromLocale("changeAttributeAction"));
|
||||
act.set(comp, attr, value);
|
||||
proj.doAction(act);
|
||||
}
|
||||
|
|
|
@ -63,14 +63,14 @@ class AttrTableSelectionModel extends AttributeSetTableModel
|
|||
}
|
||||
|
||||
if (variousFound) {
|
||||
return _("selectionVarious", "" + totalCount);
|
||||
return getFromLocale("selectionVarious", "" + totalCount);
|
||||
} else if (factoryCount == 0) {
|
||||
String circName = frame.getCanvas().getCircuit().getName();
|
||||
return _("circuitAttrTitle", circName);
|
||||
return getFromLocale("circuitAttrTitle", circName);
|
||||
} else if (factoryCount == 1) {
|
||||
return _("selectionOne", factory.getDisplayName());
|
||||
return getFromLocale("selectionOne", factory.getDisplayName());
|
||||
} else {
|
||||
return _("selectionMultiple", factory.getDisplayName(),
|
||||
return getFromLocale("selectionMultiple", factory.getDisplayName(),
|
||||
"" + factoryCount);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ class AttrTableSelectionModel extends AttributeSetTableModel
|
|||
circuitModel.setValueRequested(attr, value);
|
||||
} else {
|
||||
SetAttributeAction act = new SetAttributeAction(circuit,
|
||||
__("selectionAttributeAction"));
|
||||
getFromLocale("selectionAttributeAction"));
|
||||
for (Component comp : selection.getComponents()) {
|
||||
if (!(comp instanceof Wire)) {
|
||||
act.set(comp, attr, value);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class AttrTableToolModel extends AttributeSetTableModel {
|
|||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return _("toolAttrTitle", tool.getDisplayName());
|
||||
return getFromLocale("toolAttrTitle", tool.getDisplayName());
|
||||
}
|
||||
|
||||
public Tool getTool() {
|
||||
|
|
|
@ -3,14 +3,17 @@
|
|||
|
||||
package com.cburch.logisim.gui.main;
|
||||
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.getFromLocale;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.beans.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import com.cburch.logisim.circuit.*;
|
||||
import com.cburch.logisim.comp.*;
|
||||
import com.cburch.logisim.comp.Component;
|
||||
|
@ -20,6 +23,7 @@ import com.cburch.logisim.gui.generic.*;
|
|||
import com.cburch.logisim.prefs.AppPreferences;
|
||||
import com.cburch.logisim.proj.*;
|
||||
import com.cburch.logisim.tools.*;
|
||||
import com.cburch.logisim.tools.SelectTool.ComputingMessage;
|
||||
import com.cburch.logisim.util.*;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
|
@ -101,7 +105,7 @@ public class Canvas extends JPanel
|
|||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
viewport.setErrorMessage(null, null);
|
||||
viewport.setErrorMessage(null, 0, 0, null);
|
||||
proj.setStartupScreen(false);
|
||||
Canvas.this.requestFocus();
|
||||
drag_tool = getToolFor(e);
|
||||
|
@ -205,7 +209,7 @@ public class Canvas extends JPanel
|
|||
public void projectChanged(ProjectEvent event) {
|
||||
int act = event.getAction();
|
||||
if (act == ProjectEvent.ACTION_SET_CURRENT) {
|
||||
viewport.setErrorMessage(null, null);
|
||||
viewport.setErrorMessage(null, 0, 0, null);
|
||||
if (painter.getHaloedComponent() != null) {
|
||||
proj.getFrame().viewComponentAttributes(null, null);
|
||||
}
|
||||
|
@ -223,7 +227,7 @@ public class Canvas extends JPanel
|
|||
mappings = file.getOptions().getMouseMappings();
|
||||
}
|
||||
} else if (act == ProjectEvent.ACTION_SET_TOOL) {
|
||||
viewport.setErrorMessage(null, null);
|
||||
viewport.setErrorMessage(null, 0, 0, null);
|
||||
|
||||
Tool t = event.getTool();
|
||||
if (t == null) {
|
||||
|
@ -372,7 +376,9 @@ public class Canvas extends JPanel
|
|||
}
|
||||
|
||||
private class MyViewport extends JViewport {
|
||||
StringGetter errorMessage = null;
|
||||
String errorMessage = null;
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
Color errorColor = DEFAULT_ERROR_COLOR;
|
||||
String widthMessage = null;
|
||||
boolean isNorth = false;
|
||||
|
@ -386,9 +392,11 @@ public class Canvas extends JPanel
|
|||
|
||||
MyViewport() { }
|
||||
|
||||
void setErrorMessage(StringGetter msg, Color color) {
|
||||
void setErrorMessage(String msg, int dx, int dy, Color color) {
|
||||
if (errorMessage != msg) {
|
||||
errorMessage = msg;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
errorColor = color == null ? DEFAULT_ERROR_COLOR : color;
|
||||
paintThread.requestRepaint();
|
||||
}
|
||||
|
@ -445,7 +453,7 @@ public class Canvas extends JPanel
|
|||
getHeight() - 10);
|
||||
*/
|
||||
|
||||
StringGetter message = errorMessage;
|
||||
String message = errorMessage;
|
||||
if (message != null) {
|
||||
g.setColor(errorColor);
|
||||
paintString(g, message.toString());
|
||||
|
@ -454,13 +462,13 @@ public class Canvas extends JPanel
|
|||
|
||||
if (proj.getSimulator().isOscillating()) {
|
||||
g.setColor(DEFAULT_ERROR_COLOR);
|
||||
paintString(g, _("canvasOscillationError"));
|
||||
paintString(g, getFromLocale("canvasOscillationError"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (proj.getSimulator().isExceptionEncountered()) {
|
||||
g.setColor(DEFAULT_ERROR_COLOR);
|
||||
paintString(g, _("canvasExceptionError"));
|
||||
paintString(g, getFromLocale("canvasExceptionError"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -597,16 +605,16 @@ public class Canvas extends JPanel
|
|||
|
||||
}
|
||||
|
||||
public StringGetter getErrorMessage() {
|
||||
return viewport.errorMessage;
|
||||
public ComputingMessage getErrorMessage() {
|
||||
return new ComputingMessage(viewport.dx, viewport.dy);
|
||||
}
|
||||
|
||||
public void setErrorMessage(StringGetter message) {
|
||||
viewport.setErrorMessage(message, null);
|
||||
public void setErrorMessage(String message, int dx, int dy) {
|
||||
viewport.setErrorMessage(message, dx, dy, null);
|
||||
}
|
||||
|
||||
public void setErrorMessage(StringGetter message, Color color) {
|
||||
viewport.setErrorMessage(message, color);
|
||||
public void setErrorMessage(String message, int dx, int dy, Color color) {
|
||||
viewport.setErrorMessage(message, dx, dy, color);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -764,7 +772,7 @@ public class Canvas extends JPanel
|
|||
(int) (viewableBase.height / zoom));
|
||||
}
|
||||
|
||||
viewport.setWidthMessage(_("canvasWidthError")
|
||||
viewport.setWidthMessage(getFromLocale("canvasWidthError")
|
||||
+ (exceptions.size() == 1 ? "" : " (" + exceptions.size() + ")"));
|
||||
for (WidthIncompatibilityData ex : exceptions) {
|
||||
// See whether any of the points are on the canvas.
|
||||
|
|
|
@ -27,13 +27,13 @@ class ExplorerToolbarModel extends AbstractToolbarModel
|
|||
this.frame = frame;
|
||||
|
||||
itemToolbox = new LogisimToolbarItem(menu, "projtool.svg",
|
||||
LogisimMenuBar.VIEW_TOOLBOX, __("projectViewToolboxTip"));
|
||||
LogisimMenuBar.VIEW_TOOLBOX, getFromLocale("projectViewToolboxTip"));
|
||||
itemSimulation = new LogisimToolbarItem(menu, "projsim.svg",
|
||||
LogisimMenuBar.VIEW_SIMULATION, __("projectViewSimulationTip"));
|
||||
LogisimMenuBar.VIEW_SIMULATION, getFromLocale("projectViewSimulationTip"));
|
||||
itemLayout = new LogisimToolbarItem(menu, "projlayo.svg",
|
||||
LogisimMenuBar.EDIT_LAYOUT, __("projectEditLayoutTip"));
|
||||
LogisimMenuBar.EDIT_LAYOUT, getFromLocale("projectEditLayoutTip"));
|
||||
itemAppearance = new LogisimToolbarItem(menu, "projapp.svg",
|
||||
LogisimMenuBar.EDIT_APPEARANCE, __("projectEditAppearanceTip"));
|
||||
LogisimMenuBar.EDIT_APPEARANCE, getFromLocale("projectEditAppearanceTip"));
|
||||
|
||||
items = UnmodifiableList.decorate(Arrays.asList(new ToolbarItem[] {
|
||||
itemToolbox,
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
package com.cburch.logisim.gui.main;
|
||||
|
||||
import static com.cburch.logisim.util.LocaleString._;
|
||||
import static com.cburch.logisim.util.LocaleString.__;
|
||||
import static com.cburch.logisim.util.LocaleString.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
@ -22,20 +21,10 @@ import javax.swing.event.ChangeListener;
|
|||
import javax.swing.filechooser.FileFilter;
|
||||
import org.apache.batik.dom.GenericDOMImplementation;
|
||||
import org.apache.batik.svggen.SVGGraphics2D;
|
||||
import org.apache.batik.svggen.SVGGraphics2DIOException;
|
||||
import org.apache.fop.svg.PDFGraphics2D;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.itextpdf.awt.DefaultFontMapper;
|
||||
import com.itextpdf.awt.DefaultFontMapper.BaseFontParameters;
|
||||
import com.itextpdf.awt.PdfGraphics2D;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Rectangle;
|
||||
import com.itextpdf.text.pdf.*;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
|
@ -46,7 +35,6 @@ import com.cburch.logisim.comp.ComponentDrawContext;
|
|||
import com.cburch.logisim.data.Bounds;
|
||||
import com.cburch.logisim.file.Loader;
|
||||
import com.cburch.logisim.proj.Project;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
class ExportImage {
|
||||
private static final int SLIDER_DIVISIONS = 6;
|
||||
|
@ -67,14 +55,14 @@ class ExportImage {
|
|||
CircuitJList list = new CircuitJList(proj, true);
|
||||
if (list.getModel().getSize() == 0) {
|
||||
JOptionPane.showMessageDialog(proj.getFrame(),
|
||||
_("exportEmptyCircuitsMessage"),
|
||||
_("exportEmptyCircuitsTitle"),
|
||||
getFromLocale("exportEmptyCircuitsMessage"),
|
||||
getFromLocale("exportEmptyCircuitsTitle"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
return;
|
||||
}
|
||||
OptionsPanel options = new OptionsPanel(list);
|
||||
int action = JOptionPane.showConfirmDialog(frame,
|
||||
options, _("exportImageSelect"),
|
||||
options, getFromLocale("exportImageSelect"),
|
||||
JOptionPane.OK_CANCEL_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
if (action != JOptionPane.OK_OPTION) return;
|
||||
|
@ -87,25 +75,25 @@ class ExportImage {
|
|||
int fmt = options.getImageFormat();
|
||||
switch (options.getImageFormat()) {
|
||||
case FORMAT_GIF:
|
||||
filter = new ImageFileFilter(fmt, __("exportGifFilter"),
|
||||
filter = new ImageFileFilter(fmt, getFromLocale("exportGifFilter"),
|
||||
new String[] { "gif" });
|
||||
break;
|
||||
case FORMAT_PNG:
|
||||
filter = new ImageFileFilter(fmt, __("exportPngFilter"),
|
||||
filter = new ImageFileFilter(fmt, getFromLocale("exportPngFilter"),
|
||||
new String[] { "png" });
|
||||
break;
|
||||
case FORMAT_JPG:
|
||||
filter = new ImageFileFilter(fmt, __("exportJpgFilter"),
|
||||
filter = new ImageFileFilter(fmt, getFromLocale("exportJpgFilter"),
|
||||
new String[] { "jpg", "jpeg", "jpe", "jfi", "jfif", "jfi" });
|
||||
break;
|
||||
case FORMAT_SVG:
|
||||
filter = null;
|
||||
filter = new ImageFileFilter(fmt, __("exportSvgFilter"),
|
||||
filter = new ImageFileFilter(fmt, getFromLocale("exportSvgFilter"),
|
||||
new String[] { "svg" });
|
||||
break;
|
||||
case FORMAT_PDF:
|
||||
filter = null;
|
||||
filter = new ImageFileFilter(fmt, __("exportPdfFilter"),
|
||||
filter = new ImageFileFilter(fmt, getFromLocale("exportPdfFilter"),
|
||||
new String[] { "pdf" });
|
||||
break;
|
||||
default:
|
||||
|
@ -118,12 +106,12 @@ class ExportImage {
|
|||
JFileChooser chooser = loader.createChooser();
|
||||
if (circuits.size() > 1) {
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
chooser.setDialogTitle(_("exportImageDirectorySelect"));
|
||||
chooser.setDialogTitle(getFromLocale("exportImageDirectorySelect"));
|
||||
} else {
|
||||
chooser.setFileFilter(filter);
|
||||
chooser.setDialogTitle(_("exportImageFileSelect"));
|
||||
chooser.setDialogTitle(getFromLocale("exportImageFileSelect"));
|
||||
}
|
||||
int returnVal = chooser.showDialog(frame, _("exportImageButton"));
|
||||
int returnVal = chooser.showDialog(frame, getFromLocale("exportImageButton"));
|
||||
if (returnVal != JFileChooser.APPROVE_OPTION) return;
|
||||
|
||||
// Determine whether destination is valid
|
||||
|
@ -132,8 +120,8 @@ class ExportImage {
|
|||
if (dest.exists()) {
|
||||
if (!dest.isDirectory()) {
|
||||
int confirm = JOptionPane.showConfirmDialog(proj.getFrame(),
|
||||
_("confirmOverwriteMessage"),
|
||||
_("confirmOverwriteTitle"),
|
||||
getFromLocale("confirmOverwriteMessage"),
|
||||
getFromLocale("confirmOverwriteTitle"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
if (confirm != JOptionPane.YES_OPTION) return;
|
||||
}
|
||||
|
@ -142,8 +130,8 @@ class ExportImage {
|
|||
boolean created = dest.mkdir();
|
||||
if (!created) {
|
||||
JOptionPane.showMessageDialog(proj.getFrame(),
|
||||
_("exportNewDirectoryErrorMessage"),
|
||||
_("exportNewDirectoryErrorTitle"),
|
||||
getFromLocale("exportNewDirectoryErrorMessage"),
|
||||
getFromLocale("exportNewDirectoryErrorTitle"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
return;
|
||||
}
|
||||
|
@ -152,7 +140,7 @@ class ExportImage {
|
|||
|
||||
// Create the progress monitor
|
||||
ProgressMonitor monitor = new ProgressMonitor(frame,
|
||||
_("exportImageProgress"),
|
||||
getFromLocale("exportImageProgress"),
|
||||
null,
|
||||
0, 10000);
|
||||
monitor.setMillisToDecideToPopup(100);
|
||||
|
@ -221,13 +209,13 @@ class ExportImage {
|
|||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc.insets = new Insets(5, 0, 5, 0);
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
addGb(new JLabel(_("labelCircuits") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelCircuits") + " "));
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
addGb(new JScrollPane(list));
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
|
||||
gbc.gridy++;
|
||||
addGb(new JLabel(_("labelImageFormat") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelImageFormat") + " "));
|
||||
Box formatsPanel = new Box(BoxLayout.Y_AXIS);
|
||||
formatsPanel.add(formatPng);
|
||||
formatsPanel.add(formatGif);
|
||||
|
@ -237,12 +225,12 @@ class ExportImage {
|
|||
addGb(formatsPanel);
|
||||
|
||||
gbc.gridy++;
|
||||
addGb(new JLabel(_("labelScale") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelScale") + " "));
|
||||
addGb(slider);
|
||||
addGb(curScale);
|
||||
|
||||
gbc.gridy++;
|
||||
addGb(new JLabel(_("labelPrinterView") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelPrinterView") + " "));
|
||||
addGb(printerView);
|
||||
}
|
||||
|
||||
|
@ -275,9 +263,9 @@ class ExportImage {
|
|||
private static class ImageFileFilter extends FileFilter {
|
||||
private int type;
|
||||
private String[] extensions;
|
||||
private StringGetter desc;
|
||||
private String desc;
|
||||
|
||||
private ImageFileFilter(int type, StringGetter desc, String[] exts) {
|
||||
private ImageFileFilter(int type, String desc, String[] exts) {
|
||||
this.type = type;
|
||||
this.desc = desc;
|
||||
extensions = new String[exts.length];
|
||||
|
@ -413,7 +401,7 @@ class ExportImage {
|
|||
StringWriter writer = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(writer));
|
||||
String stackTrace = writer.toString();
|
||||
JTextArea textArea = new JTextArea( _("couldNotCreateFile") + "\n" + stackTrace);
|
||||
JTextArea textArea = new JTextArea( getFromLocale("couldNotCreateFile") + "\n" + stackTrace);
|
||||
JOptionPane.showMessageDialog(frame, textArea);
|
||||
monitor.close();
|
||||
return;
|
||||
|
@ -431,7 +419,7 @@ class ExportImage {
|
|||
((Graphics2D) g).translate(-bds.getX(), -bds.getY());
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(frame,
|
||||
_("couldNotCreateImage"));
|
||||
getFromLocale("couldNotCreateImage"));
|
||||
monitor.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.awt.event.WindowEvent;
|
|||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.WindowConstants;
|
||||
|
@ -148,7 +147,7 @@ public class Frame extends LFrame implements LocaleListener {
|
|||
class MyWindowListener extends WindowAdapter {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
if (confirmClose(_("confirmCloseTitle"))) {
|
||||
if (confirmClose(getFromLocale("confirmCloseTitle"))) {
|
||||
layoutCanvas.closeCanvas();
|
||||
Frame.this.dispose();
|
||||
}
|
||||
|
@ -409,9 +408,9 @@ public class Frame extends LFrame implements LocaleListener {
|
|||
Circuit circuit = proj.getCurrentCircuit();
|
||||
String name = proj.getLogisimFile().getName();
|
||||
if (circuit != null) {
|
||||
s = _("titleCircFileKnown", circuit.getName(), name);
|
||||
s = getFromLocale("titleCircFileKnown", circuit.getName(), name);
|
||||
} else {
|
||||
s = _("titleFileKnown", name);
|
||||
s = getFromLocale("titleFileKnown", name);
|
||||
}
|
||||
this.setTitle(s);
|
||||
myProjectListener.enableSave();
|
||||
|
@ -492,19 +491,19 @@ public class Frame extends LFrame implements LocaleListener {
|
|||
}
|
||||
|
||||
public boolean confirmClose() {
|
||||
return confirmClose(_("confirmCloseTitle"));
|
||||
return confirmClose(getFromLocale("confirmCloseTitle"));
|
||||
}
|
||||
|
||||
// returns true if user is OK with proceeding
|
||||
public boolean confirmClose(String title) {
|
||||
String message = _("confirmDiscardMessage", proj.getLogisimFile().getName());
|
||||
String message = getFromLocale("confirmDiscardMessage", proj.getLogisimFile().getName());
|
||||
|
||||
if (!proj.isFileDirty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
toFront();
|
||||
String[] options = { _("saveOption"), _("discardOption"), _("cancelOption") };
|
||||
String[] options = { getFromLocale("saveOption"), getFromLocale("discardOption"), getFromLocale("cancelOption") };
|
||||
int result = JOptionPane.showOptionDialog(this,
|
||||
message, title, 0, JOptionPane.QUESTION_MESSAGE, null,
|
||||
options, options[0]);
|
||||
|
|
|
@ -16,16 +16,15 @@ import javax.swing.Icon;
|
|||
import com.cburch.draw.toolbar.ToolbarItem;
|
||||
import com.cburch.logisim.gui.menu.LogisimMenuItem;
|
||||
import com.cburch.logisim.util.Icons;
|
||||
import com.cburch.logisim.util.StringGetter;
|
||||
|
||||
class LogisimToolbarItem implements ToolbarItem {
|
||||
private MenuListener menu;
|
||||
private Icon icon;
|
||||
private LogisimMenuItem action;
|
||||
private StringGetter toolTip;
|
||||
private String toolTip;
|
||||
|
||||
public LogisimToolbarItem(MenuListener menu, String iconName,
|
||||
LogisimMenuItem action, StringGetter toolTip) {
|
||||
LogisimMenuItem action, String toolTip) {
|
||||
this.menu = menu;
|
||||
this.icon = Icons.getIcon(iconName);
|
||||
this.action = action;
|
||||
|
@ -36,7 +35,7 @@ class LogisimToolbarItem implements ToolbarItem {
|
|||
this.icon = Icons.getIcon(iconName);
|
||||
}
|
||||
|
||||
public void setToolTip(StringGetter toolTip) {
|
||||
public void setToolTip(String toolTip) {
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,14 +45,14 @@ public class Print {
|
|||
Frame frame = proj.getFrame();
|
||||
if (list.getModel().getSize() == 0) {
|
||||
JOptionPane.showMessageDialog(proj.getFrame(),
|
||||
_("printEmptyCircuitsMessage"),
|
||||
_("printEmptyCircuitsTitle"),
|
||||
getFromLocale("printEmptyCircuitsMessage"),
|
||||
getFromLocale("printEmptyCircuitsTitle"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
return;
|
||||
}
|
||||
ParmsPanel parmsPanel = new ParmsPanel(list);
|
||||
int action = JOptionPane.showConfirmDialog(frame,
|
||||
parmsPanel, _("printParmsTitle"),
|
||||
parmsPanel, getFromLocale("printParmsTitle"),
|
||||
JOptionPane.OK_CANCEL_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
if (action != JOptionPane.OK_OPTION) {
|
||||
|
@ -81,8 +81,8 @@ public class Print {
|
|||
job.print();
|
||||
} catch (PrinterException e) {
|
||||
JOptionPane.showMessageDialog(proj.getFrame(),
|
||||
_("printError", e.toString()),
|
||||
_("printErrorTitle"),
|
||||
getFromLocale("printError", e.toString()),
|
||||
getFromLocale("printErrorTitle"),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
@ -114,21 +114,21 @@ public class Print {
|
|||
gbc.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc.insets = new Insets(5, 0, 5, 0);
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
addGb(new JLabel(_("labelCircuits") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelCircuits") + " "));
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
addGb(new JScrollPane(list));
|
||||
gbc.fill = GridBagConstraints.NONE;
|
||||
|
||||
gbc.gridy++;
|
||||
addGb(new JLabel(_("labelHeader") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelHeader") + " "));
|
||||
addGb(header);
|
||||
|
||||
gbc.gridy++;
|
||||
addGb(new JLabel(_("labelRotateToFit") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelRotateToFit") + " "));
|
||||
addGb(rotateToFit);
|
||||
|
||||
gbc.gridy++;
|
||||
addGb(new JLabel(_("labelPrinterView") + " "));
|
||||
addGb(new JLabel(getFromLocale("labelPrinterView") + " "));
|
||||
addGb(printerView);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,17 +29,17 @@ class ProjectToolbarModel extends AbstractToolbarModel
|
|||
this.frame = frame;
|
||||
|
||||
itemAdd = new LogisimToolbarItem(menu, "projadd.svg", LogisimMenuBar.ADD_CIRCUIT,
|
||||
__("projectAddCircuitTip"));
|
||||
getFromLocale("projectAddCircuitTip"));
|
||||
itemUp = new LogisimToolbarItem(menu, "projup.svg", LogisimMenuBar.MOVE_CIRCUIT_UP,
|
||||
__("projectMoveCircuitUpTip"));
|
||||
getFromLocale("projectMoveCircuitUpTip"));
|
||||
itemDown = new LogisimToolbarItem(menu, "projdown.svg", LogisimMenuBar.MOVE_CIRCUIT_DOWN,
|
||||
__("projectMoveCircuitDownTip"));
|
||||
getFromLocale("projectMoveCircuitDownTip"));
|
||||
itemDelete = new LogisimToolbarItem(menu, "projdel.svg", LogisimMenuBar.REMOVE_CIRCUIT,
|
||||
__("projectRemoveCircuitTip"));
|
||||
getFromLocale("projectRemoveCircuitTip"));
|
||||
itemLayout = new LogisimToolbarItem(menu, "projlayo.svg", LogisimMenuBar.EDIT_LAYOUT,
|
||||
__("projectEditLayoutTip"));
|
||||
getFromLocale("projectEditLayoutTip"));
|
||||
itemAppearance = new LogisimToolbarItem(menu, "projapp.svg", LogisimMenuBar.EDIT_APPEARANCE,
|
||||
__("projectEditAppearanceTip"));
|
||||
getFromLocale("projectEditAppearanceTip"));
|
||||
|
||||
items = UnmodifiableList.decorate(Arrays.asList(new ToolbarItem[] {
|
||||
itemAdd,
|
||||
|
|
|
@ -118,8 +118,8 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return numDrops == 1 ? _("dropComponentAction")
|
||||
: _("dropComponentsAction");
|
||||
return numDrops == 1 ? getFromLocale("dropComponentAction")
|
||||
: getFromLocale("dropComponentsAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -171,8 +171,8 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return numAnchor == 1 ? _("dropComponentAction")
|
||||
: _("dropComponentsAction");
|
||||
return numAnchor == 1 ? getFromLocale("dropComponentAction")
|
||||
: getFromLocale("dropComponentsAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -218,7 +218,7 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("deleteSelectionAction");
|
||||
return getFromLocale("deleteSelectionAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -247,7 +247,7 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("duplicateSelectionAction");
|
||||
return getFromLocale("duplicateSelectionAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -278,7 +278,7 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("cutSelectionAction");
|
||||
return getFromLocale("cutSelectionAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -307,7 +307,7 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("copySelectionAction");
|
||||
return getFromLocale("copySelectionAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -351,13 +351,13 @@ public class SelectionActions {
|
|||
}
|
||||
dropped.add(compFactory.getDisplayName());
|
||||
} else {
|
||||
String msg = _("pasteCloneQuery",
|
||||
String msg = getFromLocale("pasteCloneQuery",
|
||||
compFactory.getName());
|
||||
Object[] opts = { _("pasteCloneReplace"),
|
||||
_("pasteCloneIgnore"),
|
||||
_("pasteCloneCancel") };
|
||||
Object[] opts = { getFromLocale("pasteCloneReplace"),
|
||||
getFromLocale("pasteCloneIgnore"),
|
||||
getFromLocale("pasteCloneCancel") };
|
||||
int select = JOptionPane.showOptionDialog(proj.getFrame(),
|
||||
msg, _("pasteCloneTitle"), 0,
|
||||
msg, getFromLocale("pasteCloneTitle"), 0,
|
||||
JOptionPane.QUESTION_MESSAGE, null, opts, opts[0]);
|
||||
if (select == 0) {
|
||||
copyFactory = candidate;
|
||||
|
@ -383,7 +383,7 @@ public class SelectionActions {
|
|||
if (dropped != null) {
|
||||
Collections.sort(dropped);
|
||||
StringBuilder droppedStr = new StringBuilder();
|
||||
droppedStr.append(_("pasteDropMessage"));
|
||||
droppedStr.append(getFromLocale("pasteDropMessage"));
|
||||
String curName = dropped.get(0);
|
||||
int curCount = 1;
|
||||
int lines = 1;
|
||||
|
@ -411,7 +411,7 @@ public class SelectionActions {
|
|||
area.setCaretPosition(0);
|
||||
JScrollPane areaPane = new JScrollPane(area);
|
||||
JOptionPane.showMessageDialog(proj.getFrame(), areaPane,
|
||||
_("pasteDropTitle"),
|
||||
getFromLocale("pasteDropTitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("pasteClipboardAction");
|
||||
return getFromLocale("pasteClipboardAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -518,7 +518,7 @@ public class SelectionActions {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("moveSelectionAction");
|
||||
return getFromLocale("moveSelectionAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,13 +31,13 @@ class SimulationToolbarModel extends AbstractToolbarModel
|
|||
this.project = project;
|
||||
|
||||
simEnable = new LogisimToolbarItem(menu, "simplay.svg", LogisimMenuBar.SIMULATE_ENABLE,
|
||||
__("simulateEnableStepsTip"));
|
||||
getFromLocale("simulateEnableStepsTip"));
|
||||
simStep = new LogisimToolbarItem(menu, "simstep.svg", LogisimMenuBar.SIMULATE_STEP,
|
||||
__("simulateStepTip"));
|
||||
getFromLocale("simulateStepTip"));
|
||||
tickEnable = new LogisimToolbarItem(menu, "simtplay.svg", LogisimMenuBar.TICK_ENABLE,
|
||||
__("simulateEnableTicksTip"));
|
||||
getFromLocale("simulateEnableTicksTip"));
|
||||
tickStep = new LogisimToolbarItem(menu, "simtstep.svg", LogisimMenuBar.TICK_STEP,
|
||||
__("simulateTickTip"));
|
||||
getFromLocale("simulateTickTip"));
|
||||
|
||||
items = UnmodifiableList.decorate(Arrays.asList(new ToolbarItem[] {
|
||||
simEnable,
|
||||
|
@ -76,11 +76,11 @@ class SimulationToolbarModel extends AbstractToolbarModel
|
|||
boolean running = sim != null && sim.isRunning();
|
||||
boolean ticking = sim != null && sim.isTicking();
|
||||
simEnable.setIcon(running ? "simstop.svg" : "simplay.svg");
|
||||
simEnable.setToolTip(running ? __("simulateDisableStepsTip")
|
||||
: __("simulateEnableStepsTip"));
|
||||
simEnable.setToolTip(running ? getFromLocale("simulateDisableStepsTip")
|
||||
: getFromLocale("simulateEnableStepsTip"));
|
||||
tickEnable.setIcon(ticking ? "simtstop.svg" : "simtplay.svg");
|
||||
tickEnable.setToolTip(ticking ? __("simulateDisableTicksTip")
|
||||
: __("simulateEnableTicksTip"));
|
||||
tickEnable.setToolTip(ticking ? getFromLocale("simulateDisableTicksTip")
|
||||
: getFromLocale("simulateEnableTicksTip"));
|
||||
fireToolbarAppearanceChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,11 +61,11 @@ public class StatisticsDialog extends JDialog implements ActionListener {
|
|||
@Override
|
||||
public String getColumnName(int column) {
|
||||
switch (column) {
|
||||
case 0: return _("statsComponentColumn");
|
||||
case 1: return _("statsLibraryColumn");
|
||||
case 2: return _("statsSimpleCountColumn");
|
||||
case 3: return _("statsUniqueCountColumn");
|
||||
case 4: return _("statsRecursiveCountColumn");
|
||||
case 0: return getFromLocale("statsComponentColumn");
|
||||
case 1: return getFromLocale("statsLibraryColumn");
|
||||
case 2: return getFromLocale("statsSimpleCountColumn");
|
||||
case 3: return getFromLocale("statsUniqueCountColumn");
|
||||
case 4: return getFromLocale("statsRecursiveCountColumn");
|
||||
// should never happen
|
||||
default: return "??";
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ public class StatisticsDialog extends JDialog implements ActionListener {
|
|||
if (row < countsLen) {
|
||||
return count.getFactory().getDisplayName();
|
||||
} else if (row == countsLen) {
|
||||
return _("statsTotalWithout");
|
||||
return getFromLocale("statsTotalWithout");
|
||||
} else {
|
||||
return _("statsTotalWith");
|
||||
return getFromLocale("statsTotalWith");
|
||||
}
|
||||
case 1:
|
||||
if (row < countsLen) {
|
||||
|
@ -156,17 +156,17 @@ public class StatisticsDialog extends JDialog implements ActionListener {
|
|||
StatisticsTableModel model) {
|
||||
super(parent, true);
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
setTitle(_("statsDialogTitle", circuitName));
|
||||
setTitle(getFromLocale("statsDialogTitle", circuitName));
|
||||
|
||||
JTable table = new StatisticsTable();
|
||||
TableSorter mySorter = new TableSorter(model, table.getTableHeader());
|
||||
Comparator<String> comp = new CompareString("",
|
||||
_("statsTotalWithout"), _("statsTotalWith"));
|
||||
getFromLocale("statsTotalWithout"), getFromLocale("statsTotalWith"));
|
||||
mySorter.setColumnComparator(String.class, comp);
|
||||
table.setModel(mySorter);
|
||||
JScrollPane tablePane = new JScrollPane(table);
|
||||
|
||||
JButton button = new JButton(_("statsCloseButton"));
|
||||
JButton button = new JButton(getFromLocale("statsCloseButton"));
|
||||
button.addActionListener(this);
|
||||
JPanel buttonPanel = new JPanel();
|
||||
buttonPanel.add(button);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue