X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2FLogicUICanvas.java;h=b0174373d0e92451840d58b17b43262e45c38a7d;hb=3a52b6bffe52db5dd5ca907b4b3dfd368a58e14f;hp=51778c1d50f24c5c931b650d83aa6d65ee9b062d;hpb=73bddbe26c0058d040a59f38a3a22c0e299f939e;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicUICanvas.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicUICanvas.java index 51778c1d..b0174373 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicUICanvas.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicUICanvas.java @@ -22,11 +22,11 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.haspamelodica.swt.helper.zoomablecanvas.ZoomableCanvas; import net.mograsim.logic.core.types.Bit; import net.mograsim.logic.core.types.BitVector; -import net.mograsim.logic.model.model.ViewModel; -import net.mograsim.logic.model.model.components.GUIComponent; +import net.mograsim.logic.model.model.LogicModel; +import net.mograsim.logic.model.model.components.ModelComponent; import net.mograsim.logic.model.model.components.submodels.SubmodelComponent; import net.mograsim.logic.model.model.components.submodels.SubmodelInterface; -import net.mograsim.logic.model.model.wires.WireCrossPoint; +import net.mograsim.logic.model.model.wires.ModelWireCrossPoint; import net.mograsim.preferences.Preferences; /** @@ -38,11 +38,11 @@ public class LogicUICanvas extends ZoomableCanvas { private static final boolean OPEN_DEBUG_SETHIGHLEVELSTATE_SHELL = false; - private final ViewModel model; + private final LogicModel model; - public LogicUICanvas(Composite parent, int style, ViewModel model) + public LogicUICanvas(Composite parent, int style, LogicModel model) { - super(parent, style); + super(parent, style, Preferences.current().getBoolean("net.mograsim.logic.model.improvetext")); this.model = model; @@ -67,7 +67,7 @@ public class LogicUICanvas extends ZoomableCanvas if (e.button == 1) { Point click = canvasToWorldCoords(e.x, e.y); - for (GUIComponent component : model.getComponentsByName().values()) + for (ModelComponent component : model.getComponentsByName().values()) if (component.getBounds().contains(click) && component.clicked(click.x, click.y)) { redraw(); @@ -76,15 +76,15 @@ public class LogicUICanvas extends ZoomableCanvas } } - private void openDebugSetHighLevelStateShell(ViewModel model) + private void openDebugSetHighLevelStateShell(LogicModel model) { Shell debugShell = new Shell(); debugShell.setLayout(new GridLayout(2, false)); new Label(debugShell, SWT.NONE).setText("Target component: "); Combo componentSelector = new Combo(debugShell, SWT.DROP_DOWN | SWT.READ_ONLY); componentSelector.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - List componentsByItemIndex = new ArrayList<>(); - Consumer compsChanged = c -> recalculateComponentSelector(componentsByItemIndex, componentSelector, model); + List componentsByItemIndex = new ArrayList<>(); + Consumer compsChanged = c -> recalculateComponentSelector(componentsByItemIndex, componentSelector, model); model.addComponentAddedListener(compsChanged); model.addComponentRemovedListener(compsChanged); debugShell.addListener(SWT.Dispose, e -> @@ -123,7 +123,7 @@ public class LogicUICanvas extends ZoomableCanvas int componentIndex = componentSelector.getSelectionIndex(); if (componentIndex < 0 || componentIndex >= componentsByItemIndex.size()) throw new RuntimeException("No component selected"); - GUIComponent target = componentsByItemIndex.get(componentIndex); + ModelComponent target = componentsByItemIndex.get(componentIndex); String valueString = valueText.getText(); Object value; if (radioBit.getSelection()) @@ -161,18 +161,18 @@ public class LogicUICanvas extends ZoomableCanvas debugShell.open(); } - private void recalculateComponentSelector(List componentsByItemIndex, Combo componentSelector, ViewModel model) + private void recalculateComponentSelector(List componentsByItemIndex, Combo componentSelector, LogicModel model) { componentsByItemIndex.clear(); componentSelector.setItems(); addComponentSelectorItems(componentsByItemIndex, "", componentSelector, model); } - private void addComponentSelectorItems(List componentsByItemIndex, String base, Combo componentSelector, ViewModel model) + private void addComponentSelectorItems(List componentsByItemIndex, String base, Combo componentSelector, LogicModel model) { model.getComponentsByName().values().stream().sorted((c1, c2) -> c1.name.compareTo(c2.name)).forEach(c -> { - if (!(c instanceof WireCrossPoint || c instanceof SubmodelInterface)) + if (!(c instanceof ModelWireCrossPoint || c instanceof SubmodelInterface)) { String item = base + c.name; componentsByItemIndex.add(c);