@@ -496,6 +496,9 @@ public void start(Stage stage){
496496 case 9 :
497497 g = new TriStateBuffer (gc , new Rectangle2D (clickPoint .getX (), clickPoint .getY (), 100 , 50 ));
498498 break ;
499+ case 10 :
500+ g = new LightRGB (gc , new Rectangle2D (clickPoint .getX (), clickPoint .getY (), 50 , 50 ));
501+ break ;
499502 }
500503 if (g != null ){
501504 if (loaded ) this .gates .add (g );
@@ -863,6 +866,10 @@ private ContextMenu buildContextMenu(Gate found, Pin pinFound){
863866 gate .setLabel (v );
864867 });
865868 });
869+ MenuItem deleteGate = new MenuItem ("Delete" );
870+ deleteGate .setOnAction (ev -> {
871+ this .gatesToRemove .add (found );
872+ });
866873 if (pinFound != null ){
867874 final Pin pin = pinFound ;
868875 if (gate instanceof Bus ){
@@ -871,7 +878,7 @@ private ContextMenu buildContextMenu(Gate found, Pin pinFound){
871878 cm .getItems ().add (removePin );
872879 }
873880 }
874- cm .getItems ().add (changeLabel );
881+ cm .getItems ().addAll (changeLabel , deleteGate );
875882 return cm ;
876883 }
877884
@@ -906,8 +913,9 @@ private void buildSideArea(GraphicsContext gc){
906913 this .sideArea = new SideArea (gc , new Rectangle2D (WIDTH -50 , 250 , 50 , 75 ), new Rectangle2D (TOOLBAR_X , 0 , WIDTH *0.3 , HEIGHT ));
907914 this .sideArea .setButtonSize (80 );
908915 this .sideArea .addButton ("Switch" , () -> this .selectedId = 0 );
909- this .sideArea .addButton ("Wire" , () -> this .selectedId = 1 );
910916 this .sideArea .addButton ("Light" , () -> this .selectedId = 2 );
917+ this .sideArea .addButton ("RGB Light" , () -> this .selectedId = 10 );
918+ this .sideArea .addButton ("Wire" , () -> this .selectedId = 1 );
911919 this .sideArea .addButton ("NOT gate" , () -> this .selectedId = 3 );
912920 this .sideArea .addButton ("AND gate" , () -> this .selectedId = 4 );
913921 this .sideArea .addButton ("Chip" , () -> this .selectedId = 5 );
@@ -1009,7 +1017,7 @@ public static JSONObject load(File file, GraphicsContext gc, List<Gate> tempGate
10091017 if (name .equals ("AND" )){
10101018 gt = new AndGate (gc , rect );
10111019 } else if (name .equals ("LIGHT" )){
1012- gt = new Light (gc , rect );
1020+ gt = pins . size () == 3 ? new LightRGB ( gc , rect ) : new Light (gc , rect );
10131021 } else if (name .equals ("NOT" )){
10141022 gt = new NotGate (gc , rect );
10151023 } else if (name .equals ("SWITCH" )){
0 commit comments