projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added destroy for GUIComponent and GUIWire
[Mograsim.git]
/
LogicUI
/
src
/
era
/
mi
/
gui
/
model
/
wires
/
GUIWire.java
diff --git
a/LogicUI/src/era/mi/gui/model/wires/GUIWire.java
b/LogicUI/src/era/mi/gui/model/wires/GUIWire.java
index
d0bd990
..
1121335
100644
(file)
--- a/
LogicUI/src/era/mi/gui/model/wires/GUIWire.java
+++ b/
LogicUI/src/era/mi/gui/model/wires/GUIWire.java
@@
-3,6
+3,7
@@
package era.mi.gui.model.wires;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
+import era.mi.gui.model.ViewModel;
import era.mi.logic.types.Bit;
import era.mi.logic.wires.Wire;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import era.mi.logic.types.Bit;
import era.mi.logic.wires.Wire;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
@@
-10,14
+11,16
@@
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
public class GUIWire
{
public class GUIWire
{
+ private final ViewModel model;
private Pin pin1;
private Pin pin2;
private double[] path;
private Wire wire;
private Pin pin1;
private Pin pin2;
private double[] path;
private Wire wire;
- public GUIWire(
Runnable redraw
, Pin pin1, Pin pin2, Point... path)
+ public GUIWire(
ViewModel model
, Pin pin1, Pin pin2, Point... path)
{
{
+ this.model = model;
this.path = new double[path.length * 2 + 4];
for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2)
{
this.path = new double[path.length * 2 + 4];
for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2)
{
@@
-32,6
+35,13
@@
public class GUIWire
pos = pin2.getPos();
this.path[this.path.length - 2] = pos.x;
this.path[this.path.length - 1] = pos.y;
pos = pin2.getPos();
this.path[this.path.length - 2] = pos.x;
this.path[this.path.length - 1] = pos.y;
+
+ model.wireCreated(this);
+ }
+
+ public void destroy()
+ {
+ model.wireDestroyed(this);
}
public void render(GeneralGC gc)
}
public void render(GeneralGC gc)