projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added concept of wire width to GUIComponents and GUIWires
[Mograsim.git]
/
LogicUI
/
src
/
era
/
mi
/
gui
/
examples
/
Playground.java
diff --git
a/LogicUI/src/era/mi/gui/examples/Playground.java
b/LogicUI/src/era/mi/gui/examples/Playground.java
index
eafa1a5
..
372381a
100644
(file)
--- a/
LogicUI/src/era/mi/gui/examples/Playground.java
+++ b/
LogicUI/src/era/mi/gui/examples/Playground.java
@@
-1,10
+1,13
@@
package era.mi.gui.examples;
package era.mi.gui.examples;
-import era.mi.gui.LogicUICanvas;
+import org.eclipse.swt.SWT;
+
import era.mi.gui.LogicUIStandalone;
import era.mi.gui.model.ViewModel;
import era.mi.gui.model.components.GUIAndGate;
import era.mi.gui.model.components.GUINotGate;
import era.mi.gui.LogicUIStandalone;
import era.mi.gui.model.ViewModel;
import era.mi.gui.model.components.GUIAndGate;
import era.mi.gui.model.components.GUINotGate;
+import era.mi.gui.model.wires.GUIWire;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
public class Playground
{
public class Playground
{
@@
-16,17
+19,19
@@
public class Playground
{
ViewModel model = new ViewModel();
LogicUIStandalone ui = new LogicUIStandalone(model);
{
ViewModel model = new ViewModel();
LogicUIStandalone ui = new LogicUIStandalone(model);
- addComponentsAndWires(ui
.getLogicUICanvas()
, model);
+ addComponentsAndWires(ui, model);
ui.run();
}
ui.run();
}
- public static void addComponentsAndWires(LogicUI
Canvas
ui, ViewModel model)
+ public static void addComponentsAndWires(LogicUI
Standalone
ui, ViewModel model)
{
{
- GUIAndGate andGate =
ui.addComponent(new GUIAndGate(model)
);
+ GUIAndGate andGate =
new GUIAndGate(model, 1
);
andGate.moveTo(10, 10);
andGate.moveTo(10, 10);
- GUINotGate notGate =
ui.addComponent(new GUINotGate(model)
);
+ GUINotGate notGate =
new GUINotGate(model, 1
);
notGate.moveTo(10, 40);
notGate.moveTo(10, 40);
- ui.addWire(andGate.getPins().get(0), notGate.getPins().get(1));
+ new GUIWire(model, andGate.getPins().get(0), notGate.getPins().get(1), new Point(20, 50));
+
+ ui.getLogicUICanvas().addListener(SWT.KeyDown, e -> notGate.moveTo(150, 10));
}
}
\ No newline at end of file
}
}
\ No newline at end of file