projects
/
Mograsim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d9f306c
)
Added destroy for GUIComponent and GUIWire
author
Daniel Kirschten
<daniel.kirschten@gmx.de>
Tue, 28 May 2019 09:49:25 +0000
(11:49 +0200)
committer
Daniel Kirschten
<daniel.kirschten@gmx.de>
Tue, 28 May 2019 09:49:25 +0000
(11:49 +0200)
LogicUI/src/era/mi/gui/LogicUICanvas.java
patch
|
blob
|
history
LogicUI/src/era/mi/gui/model/components/GUIComponent.java
patch
|
blob
|
history
LogicUI/src/era/mi/gui/model/wires/GUIWire.java
patch
|
blob
|
history
LogicUI/src/era/mi/gui/model/wires/Pin.java
patch
|
blob
|
history
diff --git
a/LogicUI/src/era/mi/gui/LogicUICanvas.java
b/LogicUI/src/era/mi/gui/LogicUICanvas.java
index
d6b32d7
..
f94a047
100644
(file)
--- a/
LogicUI/src/era/mi/gui/LogicUICanvas.java
+++ b/
LogicUI/src/era/mi/gui/LogicUICanvas.java
@@
-29,6
+29,8
@@
public class LogicUICanvas extends ZoomableCanvas
\r
model.addComponentAddedListener(c -> redrawThreadsafe());
\r
model.addWireAddedListener(c -> redrawThreadsafe());
\r
\r
model.addComponentAddedListener(c -> redrawThreadsafe());
\r
model.addWireAddedListener(c -> redrawThreadsafe());
\r
+ model.addComponentRemovedListener(c -> redrawThreadsafe());
\r
+ model.addWireRemovedListener(c -> redrawThreadsafe());
\r
\r
addZoomedRenderer(gc ->
\r
{
\r
\r
addZoomedRenderer(gc ->
\r
{
\r
diff --git
a/LogicUI/src/era/mi/gui/model/components/GUIComponent.java
b/LogicUI/src/era/mi/gui/model/components/GUIComponent.java
index
cf9b23a
..
e266afb
100644
(file)
--- a/
LogicUI/src/era/mi/gui/model/components/GUIComponent.java
+++ b/
LogicUI/src/era/mi/gui/model/components/GUIComponent.java
@@
-37,6
+37,12
@@
public abstract class GUIComponent
model.componentCreated(this);
}
model.componentCreated(this);
}
+ public void destroy()
+ {
+ pins.forEach(p -> pinRemovedListeners.forEach(l -> l.accept(p)));
+ model.componentDestroyed(this);
+ }
+
public void moveTo(double x, double y)
{
bounds.x = x;
public void moveTo(double x, double y)
{
bounds.x = x;
diff --git
a/LogicUI/src/era/mi/gui/model/wires/GUIWire.java
b/LogicUI/src/era/mi/gui/model/wires/GUIWire.java
index
649ddb6
..
1121335
100644
(file)
--- a/
LogicUI/src/era/mi/gui/model/wires/GUIWire.java
+++ b/
LogicUI/src/era/mi/gui/model/wires/GUIWire.java
@@
-11,6
+11,7
@@
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 Pin pin1;
private Pin pin2;
private double[] path;
@@
-19,6
+20,7
@@
public class GUIWire
public GUIWire(ViewModel model, 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)
{
@@
-37,6
+39,11
@@
public class GUIWire
model.wireCreated(this);
}
model.wireCreated(this);
}
+ public void destroy()
+ {
+ model.wireDestroyed(this);
+ }
+
public void render(GeneralGC gc)
{
Color oldFG = gc.getForeground();
public void render(GeneralGC gc)
{
Color oldFG = gc.getForeground();
diff --git
a/LogicUI/src/era/mi/gui/model/wires/Pin.java
b/LogicUI/src/era/mi/gui/model/wires/Pin.java
index
3dc8967
..
cf59640
100644
(file)
--- a/
LogicUI/src/era/mi/gui/model/wires/Pin.java
+++ b/
LogicUI/src/era/mi/gui/model/wires/Pin.java
@@
-11,6
+11,7
@@
import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public class Pin
{
public final GUIComponent component;
public class Pin
{
public final GUIComponent component;
+
protected double relX;
protected double relY;
protected double relX;
protected double relY;