More helpful error for standard ID not occurring in standard mapping
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / LogicUICanvas.java
index 55fd8cf..2c82d13 100644 (file)
@@ -48,7 +48,7 @@ public class LogicUICanvas extends ZoomableCanvas
                LogicUIRenderer renderer = new LogicUIRenderer(model);
                addZoomedRenderer(gc ->
                {
-                       Color background = Preferences.current().getColor("net.mograsim.logic.ui.color.background");
+                       Color background = Preferences.current().getColor("net.mograsim.logic.model.color.background");
                        if (background != null)
                                setBackground(background);// this.setBackground, not gc.setBackground to have the background fill the canvas
                        renderer.render(gc, new Rectangle(-offX / zoom, -offY / zoom, gW / zoom, gH / zoom));
@@ -122,7 +122,7 @@ public class LogicUICanvas extends ZoomableCanvas
                                if (radioBit.getSelection())
                                        value = Bit.parse(valueString);
                                else if (radioBitVector.getSelection())
-                                       value = BitVector.parseMSBFirst(valueString);
+                                       value = BitVector.parse(valueString);
                                else
                                        throw new RuntimeException("No value type selected");
                                target.setHighLevelState(stateIDText.getText(), value);
@@ -163,7 +163,8 @@ public class LogicUICanvas extends ZoomableCanvas
 
        private void addComponentSelectorItems(List<GUIComponent> componentsByItemIndex, String base, Combo componentSelector, ViewModel model)
        {
-               for (GUIComponent c : model.getComponentsByName().values())
+               model.getComponentsByName().values().stream().sorted((c1, c2) -> c1.name.compareTo(c2.name)).forEach(c ->
+               {
                        if (!(c instanceof WireCrossPoint || c instanceof SubmodelInterface))
                        {
                                String item = base + c.name;
@@ -172,6 +173,6 @@ public class LogicUICanvas extends ZoomableCanvas
                                if (c instanceof SubmodelComponent)
                                        addComponentSelectorItems(componentsByItemIndex, item + " -> ", componentSelector, ((SubmodelComponent) c).submodel);
                        }
+               });
        }
-
 }
\ No newline at end of file