X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2FLogicUICanvas.java;h=b2b3c8acb48ebd0c87e9eb0dbe06b7b851e08fee;hb=01c5d7035474a5eb58f216b6831b2c0d8c174efa;hp=08a40a452e1762edd8ec7829f3321a821f133349;hpb=74bced7a3a38f65c65f3395cc422eb98e34da0b8;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUICanvas.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUICanvas.java index 08a40a45..b2b3c8ac 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUICanvas.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/LogicUICanvas.java @@ -23,8 +23,8 @@ import net.mograsim.logic.core.types.Bit; import net.mograsim.logic.core.types.BitVector; import net.mograsim.logic.ui.model.ViewModel; import net.mograsim.logic.ui.model.components.GUIComponent; -import net.mograsim.logic.ui.model.components.SubmodelComponent; -import net.mograsim.logic.ui.model.components.SubmodelInterface; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.ui.model.components.submodels.SubmodelInterface; import net.mograsim.logic.ui.model.wires.WireCrossPoint; import net.mograsim.preferences.Preferences; @@ -100,7 +100,7 @@ public class LogicUICanvas extends ZoomableCanvas radioBit.setText("Single bit"); Button radioBitVector = new Button(radioGroup, SWT.RADIO); radioBitVector.setText("Bitvector"); - new Label(debugShell, SWT.NONE).setText("Value string representation: "); + new Label(debugShell, SWT.NONE).setText("Value string representation: \n(Bit vectors: MSBit...LSBit)"); Text valueText = new Text(debugShell, SWT.SINGLE | SWT.LEAD | SWT.BORDER); valueText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); Button send = new Button(debugShell, SWT.PUSH); @@ -113,15 +113,16 @@ public class LogicUICanvas extends ZoomableCanvas { try { - if (componentSelector.getSelectionIndex() >= componentsByItemIndex.size()) - throw new RuntimeException("No valid component selected"); - GUIComponent target = componentsByItemIndex.get(componentSelector.getSelectionIndex()); + int componentIndex = componentSelector.getSelectionIndex(); + if (componentIndex < 0 || componentIndex >= componentsByItemIndex.size()) + throw new RuntimeException("No component selected"); + GUIComponent target = componentsByItemIndex.get(componentIndex); String valueString = valueText.getText(); Object value; if (radioBit.getSelection()) value = Bit.parse(valueString); else if (radioBitVector.getSelection()) - value = BitVector.parse(valueString); + value = BitVector.parseMSBFirst(valueString); else throw new RuntimeException("No value type selected"); target.setHighLevelState(stateIDText.getText(), value); @@ -138,7 +139,8 @@ public class LogicUICanvas extends ZoomableCanvas { if (componentSelector.getSelectionIndex() >= componentsByItemIndex.size()) throw new RuntimeException("No valid component selected"); - output.setText("Success! Value: \r\n" + componentsByItemIndex.get(componentSelector.getSelectionIndex()).getHighLevelState(stateIDText.getText())); + output.setText("Success! Value: \r\n" + + componentsByItemIndex.get(componentSelector.getSelectionIndex()).getHighLevelState(stateIDText.getText())); } catch (Exception x) {