From b3560b336b0e65063db17db599d66f7e93765436 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Thu, 2 Dec 2021 22:22:27 +0100
Subject: [PATCH] #157 - Removed old custom design checkbox

---
 .../pad/DesignPadTabViewController.java       | 34 ++-----------------
 .../resources/view/option/pad/LayoutTab.fxml  | 23 ++++++-------
 2 files changed, 12 insertions(+), 45 deletions(-)

diff --git a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java
index 9350b638..c08a6a30 100644
--- a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java
+++ b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/pad/DesignPadTabViewController.java
@@ -6,23 +6,18 @@ import de.tobias.playpad.PlayPadPlugin;
 import de.tobias.playpad.Strings;
 import de.tobias.playpad.design.modern.model.ModernCartDesign;
 import de.tobias.playpad.pad.Pad;
-import de.tobias.playpad.pad.PadSettings;
-import de.tobias.playpad.profile.Profile;
 import de.tobias.playpad.viewcontroller.PadSettingsTabViewController;
 import de.tobias.playpad.viewcontroller.design.ModernCartDesignViewController;
 import de.tobias.playpad.viewcontroller.main.IMainViewController;
 import javafx.fxml.FXML;
-import javafx.scene.control.CheckBox;
 import javafx.scene.layout.VBox;
 
 public class DesignPadTabViewController extends PadSettingsTabViewController {
 
 	@FXML
 	private VBox layoutContainer;
-	@FXML
-	private CheckBox enableLayoutCheckBox;
 
-	private Pad pad;
+	private final Pad pad;
 
 	DesignPadTabViewController(Pad pad) {
 		load("view/option/pad", "LayoutTab", Localization.getBundle());
@@ -31,26 +26,6 @@ public class DesignPadTabViewController extends PadSettingsTabViewController {
 
 	@Override
 	public void init() {
-		enableLayoutCheckBox.selectedProperty().addListener((a, b, c) ->
-		{
-			PadSettings padSettings = pad.getPadSettings();
-			if (c && !padSettings.isCustomDesign()) {
-				try {
-					padSettings.setCustomDesign(true);
-
-					ModernCartDesign layout = padSettings.getDesign();
-					layout.copyGlobalLayout(Profile.currentProfile().getProfileSettings().getDesign());
-
-					setLayoutViewController(pad);
-				} catch (Exception e) {
-					showErrorMessage(Localization.getString(Strings.ERROR_STANDARD_GEN, e.getLocalizedMessage()));
-					Logger.error(e);
-				}
-			} else if (!c && padSettings.isCustomDesign()) {
-				padSettings.setCustomDesign(false);
-				setLayoutViewController(null);
-			}
-		});
 	}
 
 	@Override
@@ -60,12 +35,7 @@ public class DesignPadTabViewController extends PadSettingsTabViewController {
 
 	@Override
 	public void loadSettings(Pad pad) {
-		PadSettings padSettings = pad.getPadSettings();
-
-		enableLayoutCheckBox.setSelected(padSettings.isCustomDesign());
-		if (padSettings.isCustomDesign()) {
-			setLayoutViewController(pad);
-		}
+		setLayoutViewController(pad);
 	}
 
 	private void setLayoutViewController(Pad pad) {
diff --git a/PlayWall/src/main/resources/view/option/pad/LayoutTab.fxml b/PlayWall/src/main/resources/view/option/pad/LayoutTab.fxml
index fa322257..a9dd2bc8 100644
--- a/PlayWall/src/main/resources/view/option/pad/LayoutTab.fxml
+++ b/PlayWall/src/main/resources/view/option/pad/LayoutTab.fxml
@@ -1,27 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-
 <?import javafx.geometry.Insets?>
-<?import javafx.scene.control.CheckBox?>
 <?import javafx.scene.control.Label?>
-<?import javafx.scene.layout.*?>
-<VBox spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.layout.HBox?>
+<?import javafx.scene.layout.VBox?>
+
+<VBox spacing="28.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1">
     <children>
-        <HBox layoutX="14.0" layoutY="13.0" spacing="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0"
-              AnchorPane.topAnchor="14.0">
+        <HBox layoutX="14.0" layoutY="13.0" spacing="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0">
             <children>
-                <Label alignment="CENTER_RIGHT" layoutX="14.0" layoutY="14.0" prefWidth="150.0"
-                       text="%padSettings.layout.label.custom"/>
-                <CheckBox fx:id="enableLayoutCheckBox" layoutX="127.0" layoutY="13.0" mnemonicParsing="false"
-                          text="%padSettings.layout.checkbox.custom"/>
+                <Label alignment="CENTER_RIGHT" layoutX="14.0" layoutY="14.0" prefWidth="150.0" text="%padSettings.layout.label.custom" />
             </children>
             <VBox.margin>
-                <Insets/>
+                <Insets />
             </VBox.margin>
         </HBox>
-        <VBox fx:id="layoutContainer" prefHeight="200.0" prefWidth="100.0"/>
+        <VBox fx:id="layoutContainer" prefHeight="200.0" prefWidth="100.0" />
     </children>
     <padding>
-        <Insets bottom="14.0" left="14.0" right="14.0" top="14.0"/>
+        <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" />
     </padding>
 </VBox>
-- 
GitLab