From 387af5bfaf708bc05754c724c397feccfaca3ee5 Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Wed, 1 Dec 2021 22:58:42 +0100 Subject: [PATCH] #157 - Removed old isCustomDesign property (partial) --- .../layout/desktop/pad/DesktopPadView.java | 24 ++++++++------- .../layout/touch/pad/TouchPadView.java | 26 +++++++++-------- .../action/feedback/ColorAdjuster.java | 29 ++++++++++--------- .../de/tobias/playpad/pad/PadSettings.java | 12 ++++---- 4 files changed, 48 insertions(+), 43 deletions(-) diff --git a/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java b/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java index e1489f34..09038fa1 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java +++ b/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java @@ -8,6 +8,7 @@ import de.thecodelabs.utils.ui.scene.BusyView; import de.thecodelabs.utils.util.ColorUtils; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.design.FeedbackDesignColorSuggester; +import de.tobias.playpad.design.modern.model.ModernCartDesign; import de.tobias.playpad.layout.desktop.DesktopMainLayoutFactory; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadStatus; @@ -354,19 +355,20 @@ public class DesktopPadView implements IPadView { @Override public void showNotFoundIcon(Pad pad, boolean show) { if (show) { - FeedbackDesignColorSuggester associator; - if (pad.getPadSettings().isCustomDesign()) { - associator = pad.getPadSettings().getDesign(); - } else { - associator = Profile.currentProfile().getProfileSettings().getDesign(); - } + FeedbackDesignColorSuggester globalDesign = Profile.currentProfile().getProfileSettings().getDesign(); + Color layoutStdColor = globalDesign.getDesignDefaultColor(); - if (associator != null) { - Color color = associator.getDesignDefaultColor(); - notFoundLabel.setColor(ColorUtils.getAppropriateTextColor(color)); - } else { - notFoundLabel.setColor(Color.RED); + if(pad != null) + { + final ModernCartDesign padDesign = pad.getPadSettings().getDesign(); + + if(padDesign.isEnableCustomBackgroundColor()) + { + layoutStdColor = padDesign.getDesignDefaultColor(); + } } + + notFoundLabel.setColor(ColorUtils.getAppropriateTextColor(layoutStdColor)); } notFoundLabel.setVisible(show); root.setOpacity(show ? 0.5 : 1.0); diff --git a/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java b/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java index c9f233e1..f0f20d4a 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java +++ b/PlayWall/src/main/java/de/tobias/playpad/layout/touch/pad/TouchPadView.java @@ -10,6 +10,7 @@ import de.thecodelabs.utils.util.OS; import de.thecodelabs.utils.util.win.User32X; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.design.FeedbackDesignColorSuggester; +import de.tobias.playpad.design.modern.model.ModernCartDesign; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.content.PadContent; import de.tobias.playpad.pad.content.PadContentFactory; @@ -283,20 +284,21 @@ public class TouchPadView implements IPadView { @Override public void showNotFoundIcon(Pad pad, boolean show) { - if (show) { - FeedbackDesignColorSuggester associator = null; - if (pad.getPadSettings().isCustomDesign()) { - associator = pad.getPadSettings().getDesign(); - } else { - associator = Profile.currentProfile().getProfileSettings().getDesign(); - } + if(show) { + FeedbackDesignColorSuggester globalDesign = Profile.currentProfile().getProfileSettings().getDesign(); + Color layoutStdColor = globalDesign.getDesignDefaultColor(); + + if(pad != null) + { + final ModernCartDesign padDesign = pad.getPadSettings().getDesign(); - if (associator != null) { - Color color = associator.getDesignDefaultColor(); - notFoundLabel.setColor(ColorUtils.getAppropriateTextColor(color)); - } else { - notFoundLabel.setColor(Color.RED); + if(padDesign.isEnableCustomBackgroundColor()) + { + layoutStdColor = padDesign.getDesignDefaultColor(); + } } + + notFoundLabel.setColor(ColorUtils.getAppropriateTextColor(layoutStdColor)); } notFoundLabel.setVisible(show); root.setOpacity(show ? 0.5 : 1.0); diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/ColorAdjuster.java b/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/ColorAdjuster.java index 43b68616..90d9df8f 100644 --- a/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/ColorAdjuster.java +++ b/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/ColorAdjuster.java @@ -12,6 +12,7 @@ import de.thecodelabs.midi.mapping.MidiKey; import de.thecodelabs.midi.midi.Midi; import de.thecodelabs.midi.midi.feedback.MidiFeedbackTranscript; import de.tobias.playpad.design.FeedbackDesignColorSuggester; +import de.tobias.playpad.design.modern.model.ModernCartDesign; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.profile.Profile; import javafx.scene.paint.Color; @@ -69,19 +70,23 @@ public class ColorAdjuster { Pad pad = suggester.getPad(action); - Color layoutStdColor = null; - Color layoutEvColor = null; + FeedbackDesignColorSuggester globalDesign = Profile.currentProfile().getProfileSettings().getDesign(); + Color layoutStdColor = globalDesign.getDesignDefaultColor(); + Color layoutEvColor = globalDesign.getDesignEventColor(); - FeedbackDesignColorSuggester design; - if (pad != null && pad.getPadSettings().isCustomDesign()) { - design = pad.getPadSettings().getDesign(); - } else { - design = Profile.currentProfile().getProfileSettings().getDesign(); - } + if(pad != null) + { + final ModernCartDesign padDesign = pad.getPadSettings().getDesign(); + + if(padDesign.isEnableCustomBackgroundColor()) + { + layoutStdColor = padDesign.getDesignDefaultColor(); + } - if (design != null) { - layoutStdColor = design.getDesignDefaultColor(); - layoutEvColor = design.getDesignEventColor(); + if(padDesign.isEnableCustomPlayColor()) + { + layoutEvColor = padDesign.getDesignEventColor(); + } } if (layoutStdColor != null) { @@ -96,9 +101,7 @@ public class ColorAdjuster { final byte channel = suggester.suggestFeedbackChannel(FeedbackType.EVENT); key.setEventFeedback(new Feedback(channel, matchedColor.getValue())); }); - } - if (layoutEvColor != null) { searchColor(transcript, layoutEvColor).ifPresent(matchedColor -> { final byte channel = suggester.suggestFeedbackChannel(FeedbackType.WARNING); key.setWarningFeedback(new Feedback(channel, matchedColor.getValue())); diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java b/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java index eadd8e2d..db4b411e 100644 --- a/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java +++ b/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java @@ -271,10 +271,7 @@ public class PadSettings { else clone.warningProperty = new SimpleObjectProperty<>(); - clone.customDesignProperty = new SimpleBooleanProperty(isCustomDesign()); - if (design != null) { - clone.design = design.copy(pad); - } + clone.design = design.copy(pad); clone.triggers = new EnumMap<>(TriggerPoint.class); triggers.forEach((key, value) -> clone.triggers.put(key, value.copy())); @@ -307,10 +304,11 @@ public class PadSettings { //// Computed public ModernColor getBackgroundColor() { - if (isCustomDesign()) { + if(design.isEnableCustomBackgroundColor()) + { return design.getBackgroundColor(); - } else { - return Profile.currentProfile().getProfileSettings().getDesign().getBackgroundColor(); } + + return Profile.currentProfile().getProfileSettings().getDesign().getBackgroundColor(); } } -- GitLab