Undid enabling HighLevelStateDebugShell a few commits ago
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / LogicUICanvas.java
index 609bf74..11e4634 100644 (file)
@@ -48,12 +48,12 @@ 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));
                });
-               model.addRedrawListener(this::redrawThreadsafe);
+               model.setRedrawHandler(this::redrawThreadsafe);
 
                addListener(SWT.MouseDown, this::mouseDown);
 
@@ -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