Fixed a bug in Am2900; created dlatch8/80; relayouted some components
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / snippets / symbolrenderers / DefaultSymbolRenderer.java
index 3faf0b9..28ad8a8 100644 (file)
@@ -3,8 +3,8 @@ package net.mograsim.logic.model.snippets.symbolrenderers;
 import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
-import net.mograsim.logic.model.model.components.GUIComponent;
-import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
+import net.mograsim.logic.model.model.components.ModelComponent;
+import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.Renderer;
 import net.mograsim.logic.model.snippets.SnippetDefinintion;
 import net.mograsim.logic.model.snippets.SubmodelComponentSnippetSuppliers;
@@ -16,9 +16,14 @@ public class DefaultSymbolRenderer implements Renderer
 {
        private static final String id = "<Symbol\nunknown>";
 
-       private final GUIComponent component;
+       private final ModelComponent component;
 
-       public DefaultSymbolRenderer(SubmodelComponent component, @SuppressWarnings("unused") Void params)
+       public DefaultSymbolRenderer(ModelComponent component)
+       {
+               this(component, null);
+       }
+
+       public DefaultSymbolRenderer(ModelComponent component, @SuppressWarnings("unused") Void params)
        {
                this.component = component;
        }
@@ -26,7 +31,7 @@ public class DefaultSymbolRenderer implements Renderer
        @Override
        public void render(GeneralGC gc, Rectangle visibleRegion)
        {
-               ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text");
+               ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.model.color.text");
                if (fg != null)
                        gc.setForeground(ColorManager.current().toColor(fg));
                Point idSize = gc.textExtent(id);
@@ -34,6 +39,18 @@ public class DefaultSymbolRenderer implements Renderer
                gc.drawText(id, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true);
        }
 
+       @Override
+       public String getIDForSerializing(IdentifyParams idParams)
+       {
+               return "default";
+       }
+
+       @Override
+       public Void getParamsForSerializing(IdentifyParams idParams)
+       {
+               return null;
+       }
+
        static
        {
                SubmodelComponentSnippetSuppliers.symbolRendererSupplier.setSnippetSupplier(DefaultSymbolRenderer.class.getCanonicalName(),