mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 15:32:40 -04:00
added a modified indicator to the window title
This commit is contained in:
parent
0c6944320c
commit
192cb531d0
@ -687,6 +687,19 @@ public class Circuit {
|
|||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* takes the listener attached to the given circuit
|
||||||
|
*
|
||||||
|
* @param circuit the circuit to take the listeners from
|
||||||
|
*/
|
||||||
|
public void getListenersFrom(Circuit circuit) {
|
||||||
|
if (circuit.listeners!=null) {
|
||||||
|
if (listeners==null)
|
||||||
|
listeners=new ArrayList<>();
|
||||||
|
listeners.addAll(circuit.listeners);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a listener for circuit changes from this circuit
|
* Remove a listener for circuit changes from this circuit
|
||||||
*
|
*
|
||||||
|
@ -68,7 +68,7 @@ import static javax.swing.JOptionPane.showInputDialog;
|
|||||||
*
|
*
|
||||||
* @author hneemann
|
* @author hneemann
|
||||||
*/
|
*/
|
||||||
public final class Main extends JFrame implements ClosingWindowListener.ConfirmSave, ErrorStopper, FileHistory.OpenInterface, DigitalRemoteInterface, StatusInterface {
|
public final class Main extends JFrame implements ClosingWindowListener.ConfirmSave, ErrorStopper, FileHistory.OpenInterface, DigitalRemoteInterface, StatusInterface, Circuit.ChangedListener {
|
||||||
private static final ArrayList<Key> ATTR_LIST = new ArrayList<>();
|
private static final ArrayList<Key> ATTR_LIST = new ArrayList<>();
|
||||||
private static final String KEY_START_STOP_ACTION = "startStop";
|
private static final String KEY_START_STOP_ACTION = "startStop";
|
||||||
private static boolean experimental;
|
private static boolean experimental;
|
||||||
@ -124,6 +124,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
private File baseFilename;
|
private File baseFilename;
|
||||||
private File filename;
|
private File filename;
|
||||||
private FileHistory fileHistory;
|
private FileHistory fileHistory;
|
||||||
|
private boolean modifiedPrefixVisible = false;
|
||||||
|
|
||||||
private Sync modelSync;
|
private Sync modelSync;
|
||||||
private Model model;
|
private Model model;
|
||||||
@ -159,6 +160,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
baseFilename = builder.baseFileName;
|
baseFilename = builder.baseFileName;
|
||||||
|
|
||||||
circuitComponent = new CircuitComponent(this, library, shapeFactory);
|
circuitComponent = new CircuitComponent(this, library, shapeFactory);
|
||||||
|
circuitComponent.getCircuit().addListener(this);
|
||||||
if (builder.circuit != null) {
|
if (builder.circuit != null) {
|
||||||
SwingUtilities.invokeLater(() -> circuitComponent.setCircuit(builder.circuit));
|
SwingUtilities.invokeLater(() -> circuitComponent.setCircuit(builder.circuit));
|
||||||
setFilename(builder.fileToOpen, false);
|
setFilename(builder.fileToOpen, false);
|
||||||
@ -341,8 +343,8 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (ClosingWindowListener.checkForSave(Main.this, Main.this)) {
|
if (ClosingWindowListener.checkForSave(Main.this, Main.this)) {
|
||||||
setFilename(null, true);
|
|
||||||
circuitComponent.setCircuit(new Circuit());
|
circuitComponent.setCircuit(new Circuit());
|
||||||
|
setFilename(null, true);
|
||||||
windowPosManager.closeAll();
|
windowPosManager.closeAll();
|
||||||
try {
|
try {
|
||||||
library.setRootFilePath(null);
|
library.setRootFilePath(null);
|
||||||
@ -617,7 +619,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modified)
|
if (modified)
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -641,7 +643,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modified)
|
if (modified)
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_removePrefix_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_removePrefix_tt")).createJMenuItem());
|
||||||
@ -670,7 +672,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modified)
|
if (modified)
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_removePinNumbers_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_removePinNumbers_tt")).createJMenuItem());
|
||||||
@ -691,7 +693,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
model.doMicroStep(false);
|
model.doMicroStep(false);
|
||||||
circuitComponent.removeHighLighted();
|
circuitComponent.removeHighLighted();
|
||||||
modelCreator.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
modelCreator.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
doStep.setEnabled(model.needsUpdate());
|
doStep.setEnabled(model.needsUpdate());
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
SwingUtilities.invokeLater(
|
SwingUtilities.invokeLater(
|
||||||
@ -710,7 +712,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
int i = model.runToBreak();
|
int i = model.runToBreak();
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
statusLabel.setText(Lang.get("stat_clocks", i));
|
statusLabel.setText(Lang.get("stat_clocks", i));
|
||||||
} catch (NodeException e1) {
|
} catch (NodeException e1) {
|
||||||
stoppedState.enter();
|
stoppedState.enter();
|
||||||
@ -989,7 +991,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
BurnException e = (BurnException) cause;
|
BurnException e = (BurnException) cause;
|
||||||
circuitComponent.addHighLightedWires(e.getValues());
|
circuitComponent.addHighLightedWires(e.getValues());
|
||||||
}
|
}
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
new ErrorMessage(message).addCause(cause).show(Main.this);
|
new ErrorMessage(message).addCause(cause).show(Main.this);
|
||||||
stoppedState.enter();
|
stoppedState.enter();
|
||||||
});
|
});
|
||||||
@ -1062,17 +1064,28 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setFilename(File filename, boolean toPrefs) {
|
private void setFilename(File filename, boolean toPrefs) {
|
||||||
|
modifiedPrefixVisible = circuitComponent.getCircuit().isModified();
|
||||||
|
String prefix = "";
|
||||||
|
if (modifiedPrefixVisible)
|
||||||
|
prefix = "*";
|
||||||
this.filename = filename;
|
this.filename = filename;
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
this.baseFilename = filename;
|
this.baseFilename = filename;
|
||||||
if (toPrefs)
|
if (toPrefs)
|
||||||
fileHistory.add(filename);
|
fileHistory.add(filename);
|
||||||
setTitle(filename + " - " + Lang.get("digital"));
|
setTitle(prefix + filename + " - " + Lang.get("digital"));
|
||||||
} else {
|
} else {
|
||||||
setTitle(Lang.get("digital"));
|
setTitle(prefix + Lang.get("digital"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void circuitHasChanged() {
|
||||||
|
if (!modifiedPrefixVisible)
|
||||||
|
setFilename(filename, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the window position manager
|
* @return the window position manager
|
||||||
*/
|
*/
|
||||||
@ -1099,7 +1112,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
model.fireManualChangeEvent();
|
model.fireManualChangeEvent();
|
||||||
model.doStep();
|
model.doStep();
|
||||||
});
|
});
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
} catch (NodeException | RuntimeException e) {
|
} catch (NodeException | RuntimeException e) {
|
||||||
showErrorAndStopModel(Lang.get("msg_errorCalculatingStep"), e);
|
showErrorAndStopModel(Lang.get("msg_errorCalculatingStep"), e);
|
||||||
}
|
}
|
||||||
@ -1117,7 +1130,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
public void hasChanged() {
|
public void hasChanged() {
|
||||||
modelCreator.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
modelCreator.addNodeElementsTo(model.nodesToUpdate(), circuitComponent.getHighLighted());
|
||||||
model.fireManualChangeEvent();
|
model.fireManualChangeEvent();
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
doStep.setEnabled(model.needsUpdate());
|
doStep.setEnabled(model.needsUpdate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1180,7 +1193,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
setDebug(false);
|
setDebug(false);
|
||||||
windowPosManager.closeAll();
|
windowPosManager.closeAll();
|
||||||
runModelState.enter(false, gifExporter);
|
runModelState.enter(false, gifExporter);
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1234,7 +1247,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
setDebug(false);
|
setDebug(false);
|
||||||
windowPosManager.closeAll();
|
windowPosManager.closeAll();
|
||||||
runModelState.enter(true, new RomLoader(romHex));
|
runModelState.enter(true, new RomLoader(romHex));
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1256,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
setDebug(true);
|
setDebug(true);
|
||||||
runModelState.enter(false, new RomLoader(romHex));
|
runModelState.enter(false, new RomLoader(romHex));
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1263,7 +1276,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
clkVal.setBool(!clkVal.getBool());
|
clkVal.setBool(!clkVal.getBool());
|
||||||
model.doStep();
|
model.doStep();
|
||||||
}
|
}
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
addressPicker.getProgramROMAddress(model);
|
addressPicker.getProgramROMAddress(model);
|
||||||
} catch (NodeException | RuntimeException e) {
|
} catch (NodeException | RuntimeException e) {
|
||||||
showErrorAndStopModel(Lang.get("err_remoteExecution"), e);
|
showErrorAndStopModel(Lang.get("err_remoteExecution"), e);
|
||||||
@ -1297,7 +1310,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
public void stop() {
|
public void stop() {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
stoppedState.enter();
|
stoppedState.enter();
|
||||||
circuitComponent.hasChanged();
|
circuitComponent.repaintNeeded();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//**********************
|
//**********************
|
||||||
|
@ -87,7 +87,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
private Vector lastMousePos;
|
private Vector lastMousePos;
|
||||||
private Sync modelSync;
|
private Sync modelSync;
|
||||||
private boolean isManualScale;
|
private boolean isManualScale;
|
||||||
private boolean hasChanged = true;
|
private boolean graphicsHasChanged = true;
|
||||||
private boolean focusWasLost = false;
|
private boolean focusWasLost = false;
|
||||||
private boolean lockMessageShown = false;
|
private boolean lockMessageShown = false;
|
||||||
private boolean antiAlias = true;
|
private boolean antiAlias = true;
|
||||||
@ -179,7 +179,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
transform.scale(f, f);
|
transform.scale(f, f);
|
||||||
transform.translate(-pos.x, -pos.y);
|
transform.translate(-pos.x, -pos.y);
|
||||||
isManualScale = true;
|
isManualScale = true;
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
});
|
});
|
||||||
|
|
||||||
addComponentListener(new ComponentAdapter() {
|
addComponentListener(new ComponentAdapter() {
|
||||||
@ -211,6 +211,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
mouseRun = new MouseControllerRun(normalCursor);
|
mouseRun = new MouseControllerRun(normalCursor);
|
||||||
|
|
||||||
setCircuit(new Circuit());
|
setCircuit(new Circuit());
|
||||||
|
circuit.addListener(this);
|
||||||
|
|
||||||
MouseDispatcher dispatcher = new MouseDispatcher();
|
MouseDispatcher dispatcher = new MouseDispatcher();
|
||||||
addMouseMotionListener(dispatcher);
|
addMouseMotionListener(dispatcher);
|
||||||
@ -321,15 +322,15 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
undoPosition = modifications.size();
|
undoPosition = modifications.size();
|
||||||
undoAction.setEnabled(true);
|
undoAction.setEnabled(true);
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* invalidates the image buffer and calls repaint();
|
* invalidates the image buffer and calls repaint();
|
||||||
*/
|
*/
|
||||||
public void hasChanged() {
|
public void repaintNeeded() {
|
||||||
hasChanged = true;
|
graphicsHasChanged = true;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +339,9 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
*/
|
*/
|
||||||
private void undo() {
|
private void undo() {
|
||||||
if (undoPosition > 0) {
|
if (undoPosition > 0) {
|
||||||
circuit = new Circuit(initialCircuit);
|
Circuit c = new Circuit(initialCircuit);
|
||||||
|
c.getListenersFrom(circuit);
|
||||||
|
circuit=c;
|
||||||
undoPosition--;
|
undoPosition--;
|
||||||
for (int i = 0; i < undoPosition; i++)
|
for (int i = 0; i < undoPosition; i++)
|
||||||
modifications.get(i).modify(circuit);
|
modifications.get(i).modify(circuit);
|
||||||
@ -346,7 +349,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
if (undoPosition == 0)
|
if (undoPosition == 0)
|
||||||
undoAction.setEnabled(false);
|
undoAction.setEnabled(false);
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +363,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
if (undoPosition == modifications.size())
|
if (undoPosition == modifications.size())
|
||||||
redoAction.setEnabled(false);
|
redoAction.setEnabled(false);
|
||||||
undoAction.setEnabled(true);
|
undoAction.setEnabled(true);
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,7 +574,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
if (needsNewBuffer && !isManualScale)
|
if (needsNewBuffer && !isManualScale)
|
||||||
fitCircuit();
|
fitCircuit();
|
||||||
|
|
||||||
if (hasChanged
|
if (graphicsHasChanged
|
||||||
|| needsNewBuffer
|
|| needsNewBuffer
|
||||||
|| highLighted.size() != highlightedPaintedSize) {
|
|| highLighted.size() != highlightedPaintedSize) {
|
||||||
|
|
||||||
@ -596,7 +599,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
// System.out.println("repaint: " + Long.toString(time) + "ms");
|
// System.out.println("repaint: " + Long.toString(time) + "ms");
|
||||||
|
|
||||||
highlightedPaintedSize = highLighted.size();
|
highlightedPaintedSize = highLighted.size();
|
||||||
hasChanged = false;
|
graphicsHasChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
g.drawImage(buffer, 0, 0, null);
|
g.drawImage(buffer, 0, 0, null);
|
||||||
@ -620,7 +623,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void circuitHasChanged() {
|
public void circuitHasChanged() {
|
||||||
hasChanged = true;
|
graphicsHasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -629,7 +632,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
* Therefore the double buffer is invalidated.
|
* Therefore the double buffer is invalidated.
|
||||||
*/
|
*/
|
||||||
public void paintImmediately() {
|
public void paintImmediately() {
|
||||||
hasChanged = true;
|
graphicsHasChanged = true;
|
||||||
paintImmediately(0, 0, getWidth(), getHeight());
|
paintImmediately(0, 0, getWidth(), getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,9 +675,8 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
* @param circuit the circuit
|
* @param circuit the circuit
|
||||||
*/
|
*/
|
||||||
public void setCircuit(Circuit circuit) {
|
public void setCircuit(Circuit circuit) {
|
||||||
|
|
||||||
if (this.circuit != null) {
|
if (this.circuit != null) {
|
||||||
this.circuit.removeListener(this);
|
circuit.getListenersFrom(this.circuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.circuit = circuit;
|
this.circuit = circuit;
|
||||||
@ -684,8 +686,6 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
undoAction.setEnabled(false);
|
undoAction.setEnabled(false);
|
||||||
redoAction.setEnabled(false);
|
redoAction.setEnabled(false);
|
||||||
|
|
||||||
circuit.addListener(this);
|
|
||||||
|
|
||||||
fitCircuit();
|
fitCircuit();
|
||||||
setModeAndReset(false, NoSync.INST);
|
setModeAndReset(false, NoSync.INST);
|
||||||
}
|
}
|
||||||
@ -718,7 +718,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
}
|
}
|
||||||
if (!newTrans.equals(transform)) {
|
if (!newTrans.equals(transform)) {
|
||||||
transform = newTrans;
|
transform = newTrans;
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
transform.scale(f, f);
|
transform.scale(f, f);
|
||||||
transform.translate(-dif.x, -dif.y);
|
transform.translate(-dif.x, -dif.y);
|
||||||
isManualScale = true;
|
isManualScale = true;
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editAttributes(VisualElement element, MouseEvent e) {
|
private void editAttributes(VisualElement element, MouseEvent e) {
|
||||||
@ -784,7 +784,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
@Override
|
@Override
|
||||||
public void libraryChanged(LibraryNode node) {
|
public void libraryChanged(LibraryNode node) {
|
||||||
circuit.clearState();
|
circuit.clearState();
|
||||||
hasChanged = true;
|
graphicsHasChanged = true;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,7 +865,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
transform.translate(delta.x / s, delta.y / s);
|
transform.translate(delta.x / s, delta.y / s);
|
||||||
pos = newPos;
|
pos = newPos;
|
||||||
isManualScale = true;
|
isManualScale = true;
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -888,7 +888,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
cutAction.setEnabled(false);
|
cutAction.setEnabled(false);
|
||||||
rotateAction.setEnabled(false);
|
rotateAction.setEnabled(false);
|
||||||
setCursor(mouseCursor);
|
setCursor(mouseCursor);
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clicked(MouseEvent e) {
|
void clicked(MouseEvent e) {
|
||||||
@ -1065,7 +1065,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
deleteAction.setActive(true);
|
deleteAction.setActive(true);
|
||||||
rotateAction.setEnabled(true);
|
rotateAction.setEnabled(true);
|
||||||
copyAction.setEnabled(true);
|
copyAction.setEnabled(true);
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1083,7 +1083,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
Vector pos = getPosVector(e);
|
Vector pos = getPosVector(e);
|
||||||
visualElement.setPos(raster(pos.add(delta)));
|
visualElement.setPos(raster(pos.add(delta)));
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,7 +1107,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
if (!isLocked()) {
|
if (!isLocked()) {
|
||||||
visualElement.rotate();
|
visualElement.rotate();
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
this.initialPos = this.pos;
|
this.initialPos = this.pos;
|
||||||
deleteAction.setActive(true);
|
deleteAction.setActive(true);
|
||||||
removeHighLighted();
|
removeHighLighted();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1159,7 +1159,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
wire.noDot();
|
wire.noDot();
|
||||||
isManualScale = true;
|
isManualScale = true;
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
}
|
}
|
||||||
@ -1472,7 +1472,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
accumulatedDelta = accumulatedDelta.add(delta);
|
accumulatedDelta = accumulatedDelta.add(delta);
|
||||||
wasMoved = true;
|
wasMoved = true;
|
||||||
|
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
lastPos = lastPos.add(delta);
|
lastPos = lastPos.add(delta);
|
||||||
center = center.add(delta);
|
center = center.add(delta);
|
||||||
}
|
}
|
||||||
@ -1494,7 +1494,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
public void rotate() {
|
public void rotate() {
|
||||||
ModifyMoveSelected.rotateElements(elements, center);
|
ModifyMoveSelected.rotateElements(elements, center);
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
accumulatedRotate++;
|
accumulatedRotate++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1564,7 +1564,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
public void rotate() {
|
public void rotate() {
|
||||||
ModifyMoveSelected.rotateElements(elements, raster(lastPos));
|
ModifyMoveSelected.rotateElements(elements, raster(lastPos));
|
||||||
circuit.modified();
|
circuit.modified();
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1635,7 +1635,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
if (manualChangeObserver != null)
|
if (manualChangeObserver != null)
|
||||||
manualChangeObserver.hasChanged();
|
manualChangeObserver.hasChanged();
|
||||||
} else
|
} else
|
||||||
hasChanged();
|
repaintNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user