diff --git a/PlayWall/src/de/tobias/playpad/action/mapper/MidiMapper.java b/PlayWall/src/de/tobias/playpad/action/mapper/MidiMapper.java index f6f60e3937638419efae957f1133e34df713eee7..f4073ed53acb60792b896faff8737c8aa3d4dfa8 100644 --- a/PlayWall/src/de/tobias/playpad/action/mapper/MidiMapper.java +++ b/PlayWall/src/de/tobias/playpad/action/mapper/MidiMapper.java @@ -104,9 +104,9 @@ public class MidiMapper extends Mapper implements ColorAssociator, MapperFeedbac } @Override - public void setColor(FeedbackMessage feedbackMessage, int value) { + public void setColor(FeedbackMessage feedbackMessage, DisplayableFeedbackColor color) { if (feedbackMessage == FeedbackMessage.STANDARD || feedbackMessage == FeedbackMessage.EVENT) { - feedback.setFeedback(feedbackMessage, value); + feedback.setFeedback(feedbackMessage, color.mapperFeedbackValue()); } else { throw new IllegalArgumentException("Unexpected Message Type."); } diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java index 86fde0806c5beead2460a7394eddb8a40ccc9d97..1e7a28801bd5d8d54637039d78530a652ca900fa 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java @@ -166,6 +166,15 @@ public class ModernCartDesign extends Design implements CartDesign, DesignColorA endStyleClass(builder); } + @Override + public void copyGlobalLayout(GlobalDesign globalLayout) { + if (globalLayout instanceof ModernGlobalDesign) { + ModernGlobalDesign modernLayoutGlobal = (ModernGlobalDesign) globalLayout; + backgroundColor = modernLayoutGlobal.getBackgroundColor(); + playColor = modernLayoutGlobal.getPlayColor(); + } + } + // Color Associator @Override public Color getAssociatedEventColor() { @@ -177,12 +186,4 @@ public class ModernCartDesign extends Design implements CartDesign, DesignColorA return Color.web(backgroundColor.getColorHi()); } - @Override - public void copyGlobalLayout(GlobalDesign globalLayout) { - if (globalLayout instanceof ModernGlobalDesign) { - ModernGlobalDesign modernLayoutGlobal = (ModernGlobalDesign) globalLayout; - backgroundColor = modernLayoutGlobal.getBackgroundColor(); - playColor = modernLayoutGlobal.getPlayColor(); - } - } } diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java index 08f9fa176eb0c24f1a3e860ef30e69dba2746491..7d2b6c00208fd4b689e9d168a234d42c64cdf840 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java @@ -3,15 +3,18 @@ package de.tobias.playpad.design.modern; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.function.Consumer; import org.dom4j.Element; +import de.tobias.playpad.DisplayableColor; import de.tobias.playpad.PseudoClasses; import de.tobias.playpad.design.CartDesign; import de.tobias.playpad.design.Design; import de.tobias.playpad.design.DesignColorAssociator; import de.tobias.playpad.design.FadeableColor; import de.tobias.playpad.design.GlobalDesign; +import de.tobias.playpad.design.IColorPickerView; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.conntent.play.Durationable; @@ -19,14 +22,16 @@ import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.project.Project; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.Warning; +import de.tobias.playpad.view.ColorPickerView; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.utils.application.ApplicationUtils; import de.tobias.utils.application.container.PathType; +import javafx.scene.Node; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.util.Duration; -public class ModernGlobalDesign extends Design implements GlobalDesign, DesignColorAssociator { +public class ModernGlobalDesign extends Design implements GlobalDesign, DesignColorAssociator, IColorPickerView { public static final String TYPE = "modern"; @@ -313,4 +318,10 @@ public class ModernGlobalDesign extends Design implements GlobalDesign, DesignCo public Color getAssociatedStandardColor() { return Color.web(backgroundColor.getColorHi()); } + + // Color View + @Override + public Node getColorInterface(Consumer<DisplayableColor> onSelection) { + return new ColorPickerView(null, ModernColor.values(), onSelection); + } } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java new file mode 100644 index 0000000000000000000000000000000000000000..aa00ed73fd8af4dbdc161e150e9bc814c4ee7911 --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java @@ -0,0 +1,42 @@ +package de.tobias.playpad.layout.desktop; + +import java.util.function.Consumer; + +import de.tobias.playpad.DisplayableColor; +import de.tobias.playpad.design.IColorPickerView; +import de.tobias.playpad.settings.Profile; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class DesktopColorPickerView implements Consumer<DisplayableColor> { + + private Stage stage; + + public DesktopColorPickerView(IColorPickerView baseView) { + Node node = baseView.getColorInterface(this); + VBox root = new VBox(node); + + stage = new Stage(); + stage.setScene(new Scene(root)); + + // Init Stage + Profile.currentProfile().currentLayout().applyCss(stage); + stage.setResizable(false); + } + + public void show() { + stage.show(); + } + + public void hide() { + stage.close(); + } + + // Handle Selected Color from View. + @Override + public void accept(DisplayableColor t) { + + } +} diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java index 0d1c754dd79d7a6759f36a893103004e41b507ed..30c0241aa88f9e7de85f59a6e01e7e53b2185e03 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java @@ -3,11 +3,14 @@ package de.tobias.playpad.layout.desktop; import java.util.Stack; import de.tobias.playpad.Strings; +import de.tobias.playpad.layout.desktop.pad.DesktopPadView; import de.tobias.playpad.pad.view.IPadView; import de.tobias.playpad.view.main.MainLayoutConnect; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.playpad.viewcontroller.main.MenuToolbarViewController; import de.tobias.utils.util.Localization; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; /** * Desktop Implmentierung des Main Layouts. @@ -21,7 +24,7 @@ public class DesktopMainLayoutConnect implements MainLayoutConnect { private static final String TYPE = "Desktop"; private DesktopMenuToolbarViewController desktopMenuToolbarViewController; - private DesktopEditMode editMode = DesktopEditMode.PLAY; + private ObjectProperty<DesktopEditMode> editMode = new SimpleObjectProperty<>(DesktopEditMode.PLAY); private Stack<IPadView> recyclingStack; @@ -66,10 +69,14 @@ public class DesktopMainLayoutConnect implements MainLayoutConnect { } public DesktopEditMode getEditMode() { - return editMode; + return editMode.get(); } public void setEditMode(DesktopEditMode editMode) { - this.editMode = editMode; + this.editMode.set(editMode); + } + + public ObjectProperty<DesktopEditMode> editModeProperty() { + return editMode; } } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java index 34ee58d90c6c8e78eb2720fb712e43060a04079b..1ada398838050487912afcb3785c8b25cb332746 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java @@ -15,6 +15,8 @@ import de.tobias.playpad.AppUserInfoStrings; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; +import de.tobias.playpad.design.GlobalDesign; +import de.tobias.playpad.design.IColorPickerView; import de.tobias.playpad.midi.Midi; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadStatus; @@ -56,6 +58,8 @@ import de.tobias.utils.util.Worker; import de.tobias.utils.util.net.FileUpload; import javafx.application.Platform; import javafx.beans.binding.Bindings; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; @@ -77,7 +81,8 @@ import javafx.scene.layout.HBox; import javafx.stage.Modality; import javafx.stage.Stage; -public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewController implements EventHandler<ActionEvent> { +public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewController + implements EventHandler<ActionEvent>, ChangeListener<DesktopEditMode> { // meuBar @FXML protected MenuBar menuBar; @@ -107,11 +112,17 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro @FXML protected Label liveLabel; + protected SegmentedButton editButtons; + protected ToggleButton playButton; + protected ToggleButton dragButton; + protected ToggleButton colorButton; + private IMainViewController mainViewController; private transient ProjectSettingsViewController projectSettingsViewController; private transient ProfileSettingsViewController profileSettingsViewController; private transient GlobalSettingsViewController globalSettingsViewController; + private transient DesktopColorPickerView colorPickerView; private DesktopMainLayoutConnect connect; @@ -119,6 +130,10 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro super("header", "de/tobias/playpad/assets/view/main/desktop/", PlayPadMain.getUiResourceBundle()); this.mainViewController = controller; this.connect = connect; + this.connect.editModeProperty().addListener(this); + + // Ist Zustand herstellen, indem Listener mit dem Initialen Wert bekannt gemacht wird. + changed(connect.editModeProperty(), null, connect.getEditMode()); initLayoutMenu(); } @@ -137,30 +152,20 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro helpMenu.getItems().add(new HelpMenuItem(helpMenu)); // Edit Mode Buttons - SegmentedButton editButtons = new SegmentedButton(); - ToggleButton playButton = new ToggleButton("", new FontIcon(FontAwesomeType.HAND_ALT_LEFT)); + editButtons = new SegmentedButton(); + playButton = new ToggleButton("", new FontIcon(FontAwesomeType.PLAY)); playButton.setFocusTraversable(false); - ToggleButton dragButton = new ToggleButton("", new FontIcon(FontAwesomeType.ARROWS)); + dragButton = new ToggleButton("", new FontIcon(FontAwesomeType.ARROWS)); dragButton.setFocusTraversable(false); - ToggleButton colorButton = new ToggleButton("", new FontIcon(FontAwesomeType.PENCIL)); + colorButton = new ToggleButton("", new FontIcon(FontAwesomeType.PENCIL)); colorButton.setFocusTraversable(false); editButtons.getButtons().addAll(playButton, dragButton, colorButton); editButtons.getToggleGroup().selectedToggleProperty().addListener((a, b, c) -> { - if (b == dragButton) { - for (IPadView view : mainViewController.getPadViews()) { - view.enableDragAndDropDesignMode(false); - } - } - if (c == playButton) { connect.setEditMode(DesktopEditMode.PLAY); } else if (c == dragButton) { connect.setEditMode(DesktopEditMode.DRAG); - System.out.println("Drag"); - for (IPadView view : mainViewController.getPadViews()) { - view.enableDragAndDropDesignMode(true); - } } else if (c == colorButton) { connect.setEditMode(DesktopEditMode.COLOR); } @@ -168,6 +173,40 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro iconHbox.getChildren().add(editButtons); } + // Desktop Edit Mode Change Listener --> Update Button + @Override + public void changed(ObservableValue<? extends DesktopEditMode> observable, DesktopEditMode oldValue, DesktopEditMode newValue) { + // handle old mode + if (oldValue == DesktopEditMode.DRAG) { + for (IPadView view : mainViewController.getPadViews()) { + view.enableDragAndDropDesignMode(false); + } + } else if (oldValue == DesktopEditMode.COLOR) { + if (colorPickerView != null) { + colorPickerView.hide(); + colorPickerView = null; + } + } + + // handle new mode + if (newValue == DesktopEditMode.PLAY) { + playButton.setSelected(true); + } else if (newValue == DesktopEditMode.DRAG) { + dragButton.setSelected(true); + for (IPadView view : mainViewController.getPadViews()) { + view.enableDragAndDropDesignMode(true); + } + } else if (newValue == DesktopEditMode.COLOR) { + colorButton.setSelected(true); + + GlobalDesign design = Profile.currentProfile().currentLayout(); + if (design instanceof IColorPickerView) { + colorPickerView = new DesktopColorPickerView((IColorPickerView) design); + colorPickerView.show(); + } + } + } + private void initLayoutMenu() { ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); Registry<MainLayoutConnect> mainLayouts = PlayPadPlugin.getRegistryCollection().getMainLayouts(); diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadDragListener.java b/PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadDragListener.java similarity index 97% rename from PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadDragListener.java rename to PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadDragListener.java index de4d05aac2bcdd4f8551172c691bdb5563611b97..d7d6eb929e56ec0fdf57280f7265f549f8adc186 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadDragListener.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadDragListener.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.layout.desktop; +package de.tobias.playpad.layout.desktop.pad; import java.io.File; import java.io.IOException; @@ -6,6 +6,8 @@ import java.util.Collection; import java.util.Set; import de.tobias.playpad.PlayPadPlugin; +import de.tobias.playpad.layout.desktop.DesktopEditMode; +import de.tobias.playpad.layout.desktop.DesktopMainLayoutConnect; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadContentRegistry; import de.tobias.playpad.pad.conntent.PadContent; diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java b/PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java similarity index 99% rename from PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java rename to PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java index 70203abd4c88ae25872c48c819f1dc8bc62d531e..7902868b72f68b3bba1c49bb8f0761e204943e39 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadView.java @@ -1,7 +1,8 @@ -package de.tobias.playpad.layout.desktop; +package de.tobias.playpad.layout.desktop.pad; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.PseudoClasses; +import de.tobias.playpad.layout.desktop.DesktopMainLayoutConnect; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadContentRegistry; import de.tobias.playpad.pad.conntent.PadContent; diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadViewController.java similarity index 94% rename from PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java rename to PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadViewController.java index f22e6f26b68b84b0e792d905415526c4432545c5..ff3de94a849397c4b68e7a2898c48af7c32f42fe 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/pad/DesktopPadViewController.java @@ -1,4 +1,4 @@ -package de.tobias.playpad.layout.desktop; +package de.tobias.playpad.layout.desktop.pad; import java.io.File; import java.io.IOException; @@ -7,6 +7,8 @@ import java.util.Set; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; +import de.tobias.playpad.layout.desktop.DesktopEditMode; +import de.tobias.playpad.layout.desktop.DesktopMainLayoutConnect; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadContentRegistry; import de.tobias.playpad.pad.PadStatus; @@ -43,7 +45,6 @@ import javafx.util.Duration; public class DesktopPadViewController implements IPadViewController, EventHandler<ActionEvent> { - protected static final String CURRENT_PAGE_BUTTON = "current-page-button"; private static final String OPEN_FOLDER = "openFolder"; private static final String DURATION_FORMAT = "%d:%02d"; @@ -59,7 +60,7 @@ public class DesktopPadViewController implements IPadViewController, EventHandle private DesktopPadDragListener padDragListener; private DesktopMainLayoutConnect connect; - + public DesktopPadViewController(DesktopPadView padView, DesktopMainLayoutConnect connect) { this.padView = padView; this.connect = connect; @@ -159,21 +160,23 @@ public class DesktopPadViewController implements IPadViewController, EventHandle @Override public void handle(ActionEvent event) { - if (event.getSource() == padView.getPlayButton()) { - onPlay(); - } else if (event.getSource() == padView.getPauseButton()) { - onPause(); - } else if (event.getSource() == padView.getStopButton()) { - onStop(); - } else if (event.getSource() == padView.getNewButton()) { - try { - onNew(event); - } catch (NoSuchComponentException e) { - // TODO Error Handling - e.printStackTrace(); + if (connect.getEditMode() == DesktopEditMode.PLAY) { + if (event.getSource() == padView.getPlayButton()) { + onPlay(); + } else if (event.getSource() == padView.getPauseButton()) { + onPause(); + } else if (event.getSource() == padView.getStopButton()) { + onStop(); + } else if (event.getSource() == padView.getNewButton()) { + try { + onNew(event); + } catch (NoSuchComponentException e) { + // TODO Error Handling + e.printStackTrace(); + } + } else if (event.getSource() == padView.getSettingsButton()) { + onSettings(); } - } else if (event.getSource() == padView.getSettingsButton()) { - onSettings(); } } @@ -271,7 +274,7 @@ public class DesktopPadViewController implements IPadViewController, EventHandle } Stage owner = mvc.getStage(); - + PadSettingsViewController padSettingsViewController = new PadSettingsViewController(pad, owner); padSettingsViewController.getStage().setOnHiding(ev -> { diff --git a/PlayWall/src/de/tobias/playpad/view/ColorView.java b/PlayWall/src/de/tobias/playpad/view/ColorPickerView.java similarity index 65% rename from PlayWall/src/de/tobias/playpad/view/ColorView.java rename to PlayWall/src/de/tobias/playpad/view/ColorPickerView.java index ff09b68021852c4ebf68451ece4cb165c952fccf..06718f47d9dffbb984ced623dd16eb4391248cfc 100644 --- a/PlayWall/src/de/tobias/playpad/view/ColorView.java +++ b/PlayWall/src/de/tobias/playpad/view/ColorPickerView.java @@ -7,9 +7,11 @@ import javafx.geometry.Insets; import javafx.scene.layout.GridPane; import javafx.scene.shape.Rectangle; -public class ColorView extends GridPane { +public class ColorPickerView extends GridPane { - public ColorView(DisplayableColor startColor, DisplayableColor[] colors, Consumer<DisplayableColor> finish) { + private Rectangle currentSelected; + + public ColorPickerView(DisplayableColor startColor, DisplayableColor[] colors, Consumer<DisplayableColor> finish) { double size = Math.sqrt(colors.length); int iSize = (int) size; if (size != iSize) { @@ -39,7 +41,15 @@ public class ColorView extends GridPane { } // EventHandler - rectangle.setOnMouseReleased(event -> finish.accept(color)); + rectangle.setOnMouseReleased(event -> + { + if (currentSelected != null) { + currentSelected.getStrokeDashArray().clear(); + } + rectangle.getStrokeDashArray().addAll(3.0); + currentSelected = rectangle; + finish.accept(color); + }); add(rectangle, x, y); } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernCartDesignViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernCartDesignViewController.java index fbda591aa744faa54b000b0b47622d76fbd5de94..99644a917a096a1badef9824f179e1d6c77fe9ab 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernCartDesignViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernCartDesignViewController.java @@ -10,7 +10,7 @@ import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.design.CartDesign; import de.tobias.playpad.design.modern.ModernCartDesign; import de.tobias.playpad.design.modern.ModernColor; -import de.tobias.playpad.view.ColorView; +import de.tobias.playpad.view.ColorPickerView; import de.tobias.playpad.viewcontroller.CartDesignViewController; import javafx.event.ActionEvent; import javafx.fxml.FXML; @@ -65,7 +65,7 @@ public class ModernCartDesignViewController extends CartDesignViewController { } private void colorChooser(Button anchorNode, ModernColor startColor, Consumer<ModernColor> onFinish) { - ColorView view = new ColorView(startColor, ModernColor.values(), (DisplayableColor t) -> + ColorPickerView view = new ColorPickerView(startColor, ModernColor.values(), (DisplayableColor t) -> { colorChooser.hide(); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernGlobalDesignViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernGlobalDesignViewController.java index 19811e5ca8d27854d38315930f809f245f152bb3..d90331f55d16e2b23717cbfa8517dfee0c81a460 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernGlobalDesignViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/design/ModernGlobalDesignViewController.java @@ -10,7 +10,7 @@ import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.design.modern.ModernColor; import de.tobias.playpad.design.modern.ModernGlobalDesign; -import de.tobias.playpad.view.ColorView; +import de.tobias.playpad.view.ColorPickerView; import de.tobias.playpad.viewcontroller.GlobalDesignViewController; import javafx.event.ActionEvent; import javafx.fxml.FXML; @@ -94,7 +94,7 @@ public class ModernGlobalDesignViewController extends GlobalDesignViewController } private void colorChooser(Button anchorNode, ModernColor startColor, Consumer<ModernColor> onFinish) { - ColorView view = new ColorView(startColor, ModernColor.values(), (DisplayableColor t) -> + ColorPickerView view = new ColorPickerView(startColor, ModernColor.values(), (DisplayableColor t) -> { colorChooser.hide(); diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java index ccbc3fe9c5896b0021c98717f8d113a236289f28..e7e59ff498246c2e1b99d7463a4711f3f2b708c3 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java @@ -15,7 +15,7 @@ import de.tobias.playpad.action.mapper.listener.KeyboardHandler; import de.tobias.playpad.action.mapper.listener.MidiHandler; import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.layout.desktop.DesktopMainLayoutConnect; -import de.tobias.playpad.layout.desktop.DesktopPadDragListener; +import de.tobias.playpad.layout.desktop.pad.DesktopPadDragListener; import de.tobias.playpad.midi.Midi; import de.tobias.playpad.midi.MidiListener; import de.tobias.playpad.pad.Pad; diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/DoubleFeedbackViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/DoubleFeedbackViewController.java index 81b5e1992d378e5a8c151cdcf0896b5ee17d0104..8a9fbce01763b5933bb0c16ae160f6e45e039f1d 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/DoubleFeedbackViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/DoubleFeedbackViewController.java @@ -11,7 +11,7 @@ import de.tobias.playpad.action.feedback.FeedbackMessage; import de.tobias.playpad.action.mapper.feedback.DoubleMidiFeedback; import de.tobias.playpad.action.mididevice.Device; import de.tobias.playpad.midi.Midi; -import de.tobias.playpad.view.ColorView; +import de.tobias.playpad.view.ColorPickerView; import de.tobias.utils.ui.ContentViewController; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; @@ -84,7 +84,7 @@ public class DoubleFeedbackViewController extends ContentViewController { color = device.getColor(feedback.getValueForFeedbackMessage(FeedbackMessage.EVENT)); } - ColorView colorView = new ColorView(color, device.getColors(), item -> + ColorPickerView colorView = new ColorPickerView(color, device.getColors(), item -> { colorChooser.hide(); if (item instanceof DisplayableFeedbackColor) { diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java index 94cfd8b3228a1e354861e70e34948b09e345036b..b29ff5718a8d4d2e294b3f9d272588bbd686bdf4 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java @@ -11,7 +11,7 @@ import de.tobias.playpad.action.feedback.FeedbackMessage; import de.tobias.playpad.action.mapper.feedback.SingleMidiFeedback; import de.tobias.playpad.action.mididevice.Device; import de.tobias.playpad.midi.Midi; -import de.tobias.playpad.view.ColorView; +import de.tobias.playpad.view.ColorPickerView; import de.tobias.utils.ui.ContentViewController; import de.tobias.utils.ui.icon.FontAwesomeType; import de.tobias.utils.ui.icon.FontIcon; @@ -65,7 +65,7 @@ public class SingleFeedbackViewController extends ContentViewController { { DisplayableFeedbackColor color = device.getColor(feedback.getValueForFeedbackMessage(FeedbackMessage.STANDARD)); - ColorView colorView = new ColorView(color, device.getColors(), item -> + ColorPickerView colorView = new ColorPickerView(color, device.getColors(), item -> { colorChooser.hide(); if (item instanceof DisplayableFeedbackColor) { diff --git a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java index 01df8244bc74cce60d4a58507f1ba2f49bf119da..5e03b647873e27cf7e417b750eaedba1b6ee6e40 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java +++ b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjustable.java @@ -2,10 +2,27 @@ package de.tobias.playpad.action.feedback; import de.tobias.playpad.pad.Pad; +/** + * Eine Action implementiert dieses Interface, falls die Feedbackfarbe automatisch an die Farbe der Kachel angepasst werden soll. + * + * @author tobias + * @since 5.0.0 + * + */ public interface ColorAdjustable { + /** + * Ist dieses Feature ative. + * + * @return <code>true</code> Active + */ public boolean isAutoFeedbackColors(); - + + /** + * Kachel, die mit dieser Action verkünpft ist. + * + * @return Pad + */ public Pad getPad(); - + } diff --git a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java index 301578f1bec761e09dcac3f463303e70a776a481..797118223479d36de28af0802e1c62a1716c61a9 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java +++ b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAdjuster.java @@ -75,13 +75,13 @@ public class ColorAdjuster { } if (layoutStdColor != null) { - DisplayableFeedbackColor associator = searchColor(colorAssociator, FeedbackMessage.STANDARD, layoutStdColor); - colorAssociator.setColor(FeedbackMessage.STANDARD, associator.mapperFeedbackValue()); + DisplayableFeedbackColor matchedColor = searchColor(colorAssociator, FeedbackMessage.STANDARD, layoutStdColor); + colorAssociator.setColor(FeedbackMessage.STANDARD, matchedColor); } if (layoutEvColor != null) { - DisplayableFeedbackColor associator = searchColor(colorAssociator, FeedbackMessage.EVENT, layoutEvColor); - colorAssociator.setColor(FeedbackMessage.EVENT, associator.mapperFeedbackValue()); + DisplayableFeedbackColor matchedColor = searchColor(colorAssociator, FeedbackMessage.EVENT, layoutEvColor); + colorAssociator.setColor(FeedbackMessage.EVENT, matchedColor); } } } diff --git a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAssociator.java b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAssociator.java index abdda9d2d12de6665cf8539801d2c57966df1b9f..339f72a96b19971bb2a388c3afc1b018ee13a42b 100644 --- a/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAssociator.java +++ b/PlayWallCore/src/de/tobias/playpad/action/feedback/ColorAssociator.java @@ -2,15 +2,51 @@ package de.tobias.playpad.action.feedback; import javafx.scene.paint.Color; +/** + * Dieses Interface wird in einem Mapper implementiert. Dabei handelt er die Anfragen für das Mapping von Farben. + * + * @author tobias + * @since 5.0.0 + */ public interface ColorAssociator { + /** + * Gibt die Gerätefarben zurück. Dabei enthalten diese ein Int Value und ein Paint. + * + * @return Liste an Farben + */ public DisplayableFeedbackColor[] getColors(); + /** + * Standardfarbe, falls nichts passendes gefunden wurde. + * + * @return Standardfarbe + */ public DisplayableFeedbackColor getDefaultStandardColor(); + /** + * Eventfarbe, falls nichts passendes gefunden wurde. + * + * @return Eventfarbe + */ public DisplayableFeedbackColor getDefaultEventColor(); - public void setColor(FeedbackMessage feedbackMessage, int value); + /** + * Setzt die Feedback Farbe für die Instanz des Mappers. + * + * @param feedbackMessage + * Art der Feedbacknachricht + * @param color + * Matched Color + */ + public void setColor(FeedbackMessage feedbackMessage, DisplayableFeedbackColor color); + /** + * Sucht zu einer {@link Color} die passende FeedbackColor, falls vorhanden. + * + * @param color + * Kachel Farbe + * @return Feedback Farbe oder null. + */ public DisplayableFeedbackColor map(Color color); } diff --git a/PlayWallCore/src/de/tobias/playpad/design/DesignColorAssociator.java b/PlayWallCore/src/de/tobias/playpad/design/DesignColorAssociator.java index 1fc348f64781d214661cfb62e72cef4f61563dec..958a5e3360d49b7339f8d0da70298f6d0aebd42e 100644 --- a/PlayWallCore/src/de/tobias/playpad/design/DesignColorAssociator.java +++ b/PlayWallCore/src/de/tobias/playpad/design/DesignColorAssociator.java @@ -2,10 +2,27 @@ package de.tobias.playpad.design; import javafx.scene.paint.Color; +/** + * Methoden für die Verwaltung der Farben, die an einer Kachel eingestellt sind. Das ist wichtig, falls Kachel eine andere Farbverwaltung + * verwendet (beispiel Lineare Gradient). + * + * @author tobias + * @since 5.0.0 + */ public interface DesignColorAssociator { + /** + * Gibt die Standardfarbe (Kacheln ohne Aktion) zurück. + * + * @return Farbe der Kachel + */ public Color getAssociatedStandardColor(); + /** + * Gibt die Eventfarbe (Kacheln mit Aktion) zurück. + * + * @return Farbe der Kachel + */ public Color getAssociatedEventColor(); } diff --git a/PlayWallCore/src/de/tobias/playpad/design/IColorPickerView.java b/PlayWallCore/src/de/tobias/playpad/design/IColorPickerView.java new file mode 100644 index 0000000000000000000000000000000000000000..cfeeae7907ac6bfc5276de46ccc7051f5c2e4ce0 --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/design/IColorPickerView.java @@ -0,0 +1,18 @@ +package de.tobias.playpad.design; + +import java.util.function.Consumer; + +import de.tobias.playpad.DisplayableColor; +import javafx.scene.Node; + +/** + * Wenn vom Design unterstützt, wird hier die GUI für Farbeinstellungen erstellt. + * + * @author tobias + * + */ +public interface IColorPickerView { + + public Node getColorInterface(Consumer<DisplayableColor> onSelection); + +} diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudio$NativeAudioDelegate.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudio$NativeAudioDelegate.class new file mode 100644 index 0000000000000000000000000000000000000000..94add9016c45847affc7a8504c1f1c7098ba07d7 Binary files /dev/null and b/PlayWallNative/bin/de/tobias/playpad/NativeAudio$NativeAudioDelegate.class differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudio.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudio.class new file mode 100644 index 0000000000000000000000000000000000000000..c5f0439f799d55d65ce9dee93b08243b9b005557 Binary files /dev/null and b/PlayWallNative/bin/de/tobias/playpad/NativeAudio.class differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandler.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..e65fdb615d0905222d4e5ac3e7e17bc396deaeb6 Binary files /dev/null and b/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandler.class differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandlerConnect.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandlerConnect.class new file mode 100644 index 0000000000000000000000000000000000000000..bd8edabc909d978389efd81ed7a6e477b245fdcd Binary files /dev/null and b/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandlerConnect.class differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudioTest.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudioTest.class new file mode 100644 index 0000000000000000000000000000000000000000..3228cfd18da92c2aab164674a4ea0aaf208e1cf8 Binary files /dev/null and b/PlayWallNative/bin/de/tobias/playpad/NativeAudioTest.class differ diff --git a/PlayWallNative/bin/de_tobias_playpad_NativeAudio.h b/PlayWallNative/bin/de_tobias_playpad_NativeAudio.h new file mode 100644 index 0000000000000000000000000000000000000000..4bd710308b879f953bd90b3e96a9aa1ec1e2ef92 --- /dev/null +++ b/PlayWallNative/bin/de_tobias_playpad_NativeAudio.h @@ -0,0 +1,85 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class de_tobias_playpad_NativeAudio */ + +#ifndef _Included_de_tobias_playpad_NativeAudio +#define _Included_de_tobias_playpad_NativeAudio +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: de_tobias_playpad_NativeAudio + * Method: play + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_play + (JNIEnv *, jclass, jint); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: pause + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_pause + (JNIEnv *, jclass, jint); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: stop + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_stop + (JNIEnv *, jclass, jint); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: getVolume + * Signature: (I)D + */ +JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_NativeAudio_getVolume + (JNIEnv *, jclass, jint); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: setVolume + * Signature: (ID)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_setVolume + (JNIEnv *, jclass, jint, jdouble); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: load + * Signature: (ILjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_de_tobias_playpad_NativeAudio_load + (JNIEnv *, jclass, jint, jstring); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: dispose + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_dispose + (JNIEnv *, jclass, jint); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: getDuration + * Signature: (I)D + */ +JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_NativeAudio_getDuration + (JNIEnv *, jclass, jint); + +/* + * Class: de_tobias_playpad_NativeAudio + * Method: getPosition + * Signature: (I)D + */ +JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_NativeAudio_getPosition + (JNIEnv *, jclass, jint); + +#ifdef __cplusplus +} +#endif +#endif