Made GUIWires more colorful
[Mograsim.git] / LogicUI / src / era / mi / components / gui / GUIMux.java
index 509a8cc..df61ca7 100644 (file)
@@ -9,6 +9,7 @@ import era.mi.logic.components.Mux;
 import era.mi.logic.wires.WireArray;
 import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 
 public class GUIMux extends Mux implements BasicGUIComponent
 {
@@ -20,7 +21,7 @@ public class GUIMux extends Mux implements BasicGUIComponent
        {
                super(processTime, out, select, inputs);
 
-               double height = inputs.length * 10;
+               double height = inputs.length * 5;
                if(height < 10)
                        height = 10;
                this.height = height;
@@ -36,8 +37,8 @@ public class GUIMux extends Mux implements BasicGUIComponent
 
                {
                        connectedWireArraysModifiable.addAll(Arrays.asList(inputs));
-                       double inputHeightIncrement = height / (inputs.length - 1);
-                       double inputHeight = 10;
+                       double inputHeightIncrement = (height + 20) / inputs.length;
+                       double inputHeight = inputHeightIncrement / 2;
                        for(int i = 0; i < inputs.length; i ++, inputHeight += inputHeightIncrement)
                                wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight));
                }
@@ -45,6 +46,12 @@ public class GUIMux extends Mux implements BasicGUIComponent
                this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);
                this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);
        }
+
+       @Override
+       public Rectangle getBounds()
+       {
+               return new Rectangle(0, 0, 20, height + 20);
+       }
        @Override
        public void render(GeneralGC gc)
        {