diff --git a/PlayWall/.classpath b/PlayWall/.classpath index 37d7d01446dd9cf6c9d6d15fdd163b9fc97edae4..a8ad48e81f02fb008bf288df3ca4de61c39311b2 100644 --- a/PlayWall/.classpath +++ b/PlayWall/.classpath @@ -1,19 +1,19 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry excluding="**/.DS_Store|**/.gitignore|icon.icns|icon.ico|de/tobias/playpad/viewcontroller/main/MainMenuBarController.java|de/tobias/playpad/viewcontroller/main/MainToolbarController.java|de/tobias/playpad/viewcontroller/main/MainViewController.java|de/tobias/playpad/viewcontroller/pad/PadViewController.java|de/tobias/playpad/view/PadView.java" kind="src" path="src"/> - <classpathentry excluding="**/.gitignor|de/tobias/playpad/assets/files/dialogDnD.pxm" kind="src" path="assets"/> - <classpathentry kind="src" path="test"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ControlFx"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/XML"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/YML"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/HTML Builder"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JNA"/> - <classpathentry combineaccessrules="false" kind="src" path="/libUtils"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Plugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/TinySound"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JLayer"/> - <classpathentry combineaccessrules="false" kind="src" path="/PlayWallCore"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry excluding="**/.DS_Store|**/.gitignore|de/tobias/playpad/view/PadView.java|de/tobias/playpad/viewcontroller/pad/PadViewController.java|icon.icns|icon.ico" kind="src" path="src"/> + <classpathentry excluding="**/.gitignor|de/tobias/playpad/assets/files/dialogDnD.pxm" kind="src" path="assets"/> + <classpathentry kind="src" path="test"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ControlFx"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/XML"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/YML"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/HTML Builder"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JNA"/> + <classpathentry combineaccessrules="false" kind="src" path="/libUtils"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Plugins"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/TinySound"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JLayer"/> + <classpathentry combineaccessrules="false" kind="src" path="/PlayWallCore"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties index 6ee0ca9c819acf10983f857e0f80ab3386931e1f..cae2209260275be3c7b92c311c6080f0156b0ed4 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties +++ b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties @@ -210,13 +210,22 @@ CartAction.Mode.PLAY_STOP=Play/Stop CartAction.Mode.PLAY_PAUSE=Play/Pause CartAction.Mode.PLAY_HOLD=Play/Hold -#UI - Dialog -AutoUpdate +#UI - Dialog - AutoUpdate UI.Dialog.AutoUpdate.Header=Aktualisierung UI.Dialog.AutoUpdate.Content=Es sind Aktualisierungen verf�gbar. M�chten Sie diese jetzt installieren?\n{} UI.Dialog.AutoUpdate.Title=Aktualisierung UI.Dialog.AutoUpdate.Checkbox=Diese Aktualisierung nicht mehr anzeigen. -UI.Dialog.AutoUpdate.Butto.Update=Jetzt aktualisieren -UI.Dialog.AutoUpdate.Butto.Cancel=Jetzt nicht aktualisieren +UI.Dialog.AutoUpdate.Button.Update=Jetzt aktualisieren +UI.Dialog.AutoUpdate.Button.Cancel=Jetzt nicht aktualisieren + +#UI - Dialog - Save +UI.Dialog.Save.Header=Speichern +UI.Dialog.Save.Content=M�chten Sie das Projekt speichern? +UI.Dialog.Save.Title=Speichern +UI.Dialog.Save.Checkbox=Immer automatisch speichern und diesen Dialog nicht mehr anzeigen. +UI.Dialog.Save.Button.Yes=Speichern +UI.Dialog.Save.Button.No=Nicht Speichern +UI.Dialog.Save.Button.Cancel=Abbrechen # Update Channel - BaseName UpdateChannel.STABLE=Stabil diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainMenu.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/main/mainMenu.fxml deleted file mode 100644 index 4811fc21c824512215069318915dd99aed3ea491..0000000000000000000000000000000000000000 --- a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainMenu.fxml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<?import java.lang.*?> -<?import javafx.scene.control.*?> -<?import javafx.scene.input.*?> - -<MenuBar fx:id="menuBar" prefHeight="29.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.tobias.playpad.viewcontroller.main.MainMenuBarController"> - <menus> - <Menu mnemonicParsing="false" text="%main.menu.file"> - <items> - <MenuItem mnemonicParsing="false" onAction="#newDocumentHandler" text="%main.menuitem.new"> - <accelerator> - <KeyCodeCombination alt="UP" code="N" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator> - </MenuItem> - <Menu fx:id="recentOpenMenu" mnemonicParsing="false" text="%main.menuitem.recentFiles" /> - <MenuItem mnemonicParsing="false" onAction="#openDocumentHandler" text="%main.menuitem.project"> - <accelerator> - <KeyCodeCombination alt="UP" code="O" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator> - </MenuItem> - <MenuItem fx:id="saveMenuItem" mnemonicParsing="false" onAction="#saveMenuHandler" text="%main.menuitem.save"> - <accelerator> - <KeyCodeCombination alt="UP" code="S" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator> - </MenuItem> - <SeparatorMenuItem mnemonicParsing="false" /> - <MenuItem fx:id="profileMenu" mnemonicParsing="false" onAction="#profileMenuHandler" text="%main.menuitem.profile" /> - <SeparatorMenuItem mnemonicParsing="false" /> - <MenuItem mnemonicParsing="false" onAction="#printMenuHandler" text="%main.menuitem.print"> - <accelerator> - <KeyCodeCombination alt="UP" code="P" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator></MenuItem> - </items> - </Menu> - <Menu mnemonicParsing="false" text="%main.menu.option"> - <items> - <CheckMenuItem fx:id="dndModeMenuItem" mnemonicParsing="false" onAction="#dndModeHandler" text="%main.menuitem.dnd"> - <accelerator> - <KeyCodeCombination alt="UP" code="M" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator> - </CheckMenuItem> - <MenuItem fx:id="errorMenu" mnemonicParsing="false" onAction="#errorMenuHandler" text="%main.menuitem.errors"> - <accelerator> - <KeyCodeCombination alt="UP" code="E" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator> - </MenuItem> - <SeparatorMenuItem mnemonicParsing="false" /> - <MenuItem mnemonicParsing="false" onAction="#pluginMenuItemHandler" text="%main.menuitem.plugins" /> - <SeparatorMenuItem mnemonicParsing="false" /> - <MenuItem fx:id="settingsMenuItem" mnemonicParsing="false" onAction="#settingsHandler" text="%main.menuitem.settings"> - <accelerator> - <KeyCodeCombination alt="UP" code="COMMA" control="UP" meta="UP" shift="UP" shortcut="DOWN" /> - </accelerator> - </MenuItem> - </items> - </Menu> - <Menu mnemonicParsing="false" text="%main.menu.view"> - <items> - <CheckMenuItem fx:id="alwaysOnTopItem" mnemonicParsing="false" onAction="#alwaysOnTopItemHandler" text="%main.menuitem.onTop" /> - <CheckMenuItem fx:id="fullScreenMenuItem" mnemonicParsing="false" onAction="#fullScreenMenuItemHandler" text="%main.menuitem.fullScreen"> - <accelerator> - <KeyCodeCombination alt="UP" code="F" control="UP" meta="UP" shift="DOWN" shortcut="DOWN" /> - </accelerator></CheckMenuItem> - </items> - </Menu> - <Menu fx:id="extensionMenu" mnemonicParsing="false" text="%main.menu.extension" /> - <Menu mnemonicParsing="false" text="%main.menu.info"> - <items> - <MenuItem mnemonicParsing="false" onAction="#aboutMenuHandler" text="%main.menuitem.about" /> - <MenuItem mnemonicParsing="false" onAction="#visiteWebsiteMenuHandler" text="%main.menuitem.website" /> - <MenuItem mnemonicParsing="false" onAction="#sendErrorMenuItem" text="%main.menuitem.senderror" /> - </items> - </Menu> - </menus> -</MenuBar> diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainToolbarView.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/main/mainToolbarView.fxml deleted file mode 100644 index 38c491f3c86f75ba41c1599a33c1f35317b49427..0000000000000000000000000000000000000000 --- a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainToolbarView.fxml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<?import java.lang.*?> -<?import javafx.scene.control.*?> -<?import javafx.scene.layout.*?> -<?import javafx.scene.text.*?> - -<ToolBar fx:id="toolbar" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.tobias.playpad.viewcontroller.main.MainToolbarController"> - <items> - <HBox fx:id="toolbarHBox" alignment="CENTER_LEFT" maxWidth="1.7976931348623157E308" prefHeight="28.0" prefWidth="586.0" spacing="14.0"> - <children> - <HBox fx:id="pageHBox" alignment="CENTER_LEFT" spacing="14.0" HBox.hgrow="ALWAYS" /> - <HBox fx:id="iconHbox" alignment="CENTER" spacing="14.0" /> - <HBox alignment="CENTER" spacing="7.0" HBox.hgrow="NEVER"> - <children> - <Label fx:id="volumeDownLabel"> - <font> - <Font size="24.0" /> - </font> - </Label> - <Slider fx:id="volumeSlider" focusTraversable="false" max="1.0" /> - <Label fx:id="volumeUpLabel"> - <font> - <Font size="24.0" /> - </font> - </Label> - </children> - </HBox> - </children> - </HBox> - </items> -</ToolBar> diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainView.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/main/mainView.fxml index 42936d2dd659548c8a2115bf5153f2c11155c90a..dbb3ca375d05f004c8b2d2ee7fa5e56651d5c719 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainView.fxml +++ b/PlayWall/assets/de/tobias/playpad/assets/view/main/mainView.fxml @@ -10,20 +10,14 @@ <children> <VBox layoutX="-0.7071067690849304" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <children> - <fx:include fx:id="menuBar" source="mainMenu.fxml" /> - <fx:include fx:id="toolbar" source="mainToolbarView.fxml" /> - <AnchorPane fx:id="gridContainer" layoutX="-0.7071067690849304" layoutY="68.29289245605469" AnchorPane.bottomAnchor="-0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="69.0" VBox.vgrow="ALWAYS"> + <VBox fx:id="headerBox" /> + <AnchorPane fx:id="gridContainer" VBox.vgrow="ALWAYS"> <children> - <GridPane fx:id="padGridPane" layoutX="0.7071067690849304" layoutY="0.7071075439453125" prefHeight="331.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <GridPane fx:id="padGridPane" gridLinesVisible="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" VBox.vgrow="ALWAYS"> </GridPane> </children> </AnchorPane> </children> </VBox> - <Label fx:id="liveLabel" alignment="CENTER" mouseTransparent="true" prefHeight="40.0" prefWidth="600.0" text="%main.label.live" textFill="RED" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="29.0"> - <font> - <Font name="System Bold" size="26.0" /> - </font> - </Label> </children> </AnchorPane> diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainViewV2.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/main/mainViewV2.fxml deleted file mode 100644 index dbb3ca375d05f004c8b2d2ee7fa5e56651d5c719..0000000000000000000000000000000000000000 --- a/PlayWall/assets/de/tobias/playpad/assets/view/main/mainViewV2.fxml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<?import javafx.scene.text.*?> -<?import javafx.scene.input.*?> -<?import javafx.scene.control.*?> -<?import java.lang.*?> -<?import javafx.scene.layout.*?> - -<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> - <children> - <VBox layoutX="-0.7071067690849304" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <children> - <VBox fx:id="headerBox" /> - <AnchorPane fx:id="gridContainer" VBox.vgrow="ALWAYS"> - <children> - <GridPane fx:id="padGridPane" gridLinesVisible="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" VBox.vgrow="ALWAYS"> - </GridPane> - </children> - </AnchorPane> - </children> - </VBox> - </children> -</AnchorPane> diff --git a/PlayWall/src/de/tobias/playpad/PlayPadImpl.java b/PlayWall/src/de/tobias/playpad/PlayPadImpl.java index f741544c83b542f98e71dd7c17ebdc4acc488194..8cc7555be8200f8b4934ae1d5461fad5d385810e 100644 --- a/PlayWall/src/de/tobias/playpad/PlayPadImpl.java +++ b/PlayWall/src/de/tobias/playpad/PlayPadImpl.java @@ -31,7 +31,7 @@ import de.tobias.playpad.settings.GlobalSettings; import de.tobias.playpad.view.MapperOverviewViewController; import de.tobias.playpad.viewcontroller.IPadSettingsViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; -import de.tobias.playpad.viewcontroller.main.MainViewControllerV2; +import de.tobias.playpad.viewcontroller.main.MainViewController; import de.tobias.playpad.viewcontroller.option.IProfileSettingsViewController; import de.tobias.utils.application.ApplicationUtils; import de.tobias.utils.application.container.PathType; @@ -55,7 +55,7 @@ public class PlayPadImpl implements PlayPad { private PluginManager pluginManager; private Set<Path> deletedPlugins; - private MainViewControllerV2 mainViewController; + private MainViewController mainViewController; private Project currentProject; protected GlobalSettings globalSettings; @@ -204,7 +204,7 @@ public class PlayPadImpl implements PlayPad { public void openProject(Project project) { if (mainViewController == null) { - mainViewController = new MainViewControllerV2(mainViewListeners); + mainViewController = new MainViewController(mainViewListeners); } currentProject = project; mainViewController.openProject(project); diff --git a/PlayWall/src/de/tobias/playpad/PlayPadMain.java b/PlayWall/src/de/tobias/playpad/PlayPadMain.java index 94eb0f52590721f81d95ddca5ecd014b43ea9dbf..4a2cfbb92b6a30a51d6f71cc1d21dbb1d71e36da 100644 --- a/PlayWall/src/de/tobias/playpad/PlayPadMain.java +++ b/PlayWall/src/de/tobias/playpad/PlayPadMain.java @@ -174,7 +174,7 @@ public class PlayPadMain extends Application implements LocalizationDelegate { e.printStackTrace(); } }); - if (autoUpdateDialog.isIgnoreUpdate()) { + if (autoUpdateDialog.isSelected()) { globalSettings.setIgnoreUpdate(true); } }); diff --git a/PlayWall/src/de/tobias/playpad/Strings.java b/PlayWall/src/de/tobias/playpad/Strings.java index 91b386b7805dc7af6180a8364447fbea9cbcfb4d..ecd9bf62c80aef675ee7fd54034d9ed29e3282c5 100644 --- a/PlayWall/src/de/tobias/playpad/Strings.java +++ b/PlayWall/src/de/tobias/playpad/Strings.java @@ -46,6 +46,7 @@ public class Strings { // UI - Window - Main public static final String UI_Window_Main_CloseRequest = "UI.Window.Main.CloseRequest"; + @Deprecated public static final String UI_Window_Main_SaveRequest = "UI.Window.Main.SaveRequest"; public static final String UI_Window_Main_PageButton = "UI.Window.Main.PageButton"; @@ -205,8 +206,17 @@ public class Strings { public static final String UI_Dialog_AutoUpdate_Content = "UI.Dialog.AutoUpdate.Content"; public static final String UI_Dialog_AutoUpdate_Checkbox = "UI.Dialog.AutoUpdate.Checkbox"; public static final String UI_Dialog_AutoUpdate_Title = "UI.Dialog.AutoUpdate.Title"; - public static final String UI_Dialog_AutoUpdate_Butto_Update = "UI.Dialog.AutoUpdate.Butto.Update"; - public static final String UI_Dialog_AutoUpdate_Butto_Cancel = "UI.Dialog.AutoUpdate.Butto.Cancel"; + public static final String UI_Dialog_AutoUpdate_Button_Update = "UI.Dialog.AutoUpdate.Button.Update"; + public static final String UI_Dialog_AutoUpdate_Button_Cancel = "UI.Dialog.AutoUpdate.Button.Cancel"; + + // UI - Dialog - Save + public static final String UI_Dialog_Save_Header = "UI.Dialog.Save.Header"; + public static final String UI_Dialog_Save_Content = "UI.Dialog.Save.Content"; + public static final String UI_Dialog_Save_Checkbox = "UI.Dialog.Save.Checkbox"; + public static final String UI_Dialog_Save_Title = "UI.Dialog.Save.Title"; + public static final String UI_Dialog_Save_Button_Yes = "UI.Dialog.Save.Button.Yes"; + public static final String UI_Dialog_Save_Button_No = "UI.Dialog.Save.Button.No"; + public static final String UI_Dialog_Save_Button_Cancel = "UI.Dialog.Save.Button.Cancel"; // Update Channel - Basename public static final String Update_Channel_BaseName = "UpdateChannel."; diff --git a/PlayWall/src/de/tobias/playpad/design/classic/ClassicCartDesign.java b/PlayWall/src/de/tobias/playpad/design/classic/ClassicCartDesign.java index b0acae1a9b7f62f49739778462dc7195821305fa..af5a1e1ff864e345625432827a6911c7b0c3a7bd 100644 --- a/PlayWall/src/de/tobias/playpad/design/classic/ClassicCartDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/classic/ClassicCartDesign.java @@ -15,8 +15,8 @@ import de.tobias.playpad.PseudoClasses; import de.tobias.playpad.design.CartDesign; import de.tobias.playpad.design.Design; import de.tobias.playpad.design.GlobalDesign; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.settings.Warning; import de.tobias.utils.util.ColorXMLUtils; import javafx.application.Platform; @@ -210,8 +210,8 @@ public class ClassicCartDesign extends Design implements CartDesign { } @Override - public void handleWarning(IPadViewControllerV2 controller, Warning warning, GlobalDesign layout) { - final IPadViewV2 view = controller.getView(); + public void handleWarning(IPadViewController controller, Warning warning, GlobalDesign layout) { + final IPadView view = controller.getView(); try { while (true) { diff --git a/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java b/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java index 93bfe0763f1bf4a92c734bf80d5a80cbe0ebb37b..e317fc50cd6c4398292a962305ef26245ed71344 100644 --- a/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/classic/ClassicGlobalDesign.java @@ -12,8 +12,8 @@ import de.tobias.playpad.design.Design; import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadSettings; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.project.Project; import de.tobias.playpad.settings.Warning; import de.tobias.playpad.viewcontroller.main.IMainViewController; @@ -345,8 +345,8 @@ public class ClassicGlobalDesign extends Design implements GlobalDesign { } @Override - public void handleWarning(IPadViewControllerV2 controller, Warning warning) { - final IPadViewV2 view = controller.getView(); + public void handleWarning(IPadViewController controller, Warning warning) { + final IPadView view = controller.getView(); try { while (true) { diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java index a669ac9f977997a6a6c5102d2a520aaab1d57f0a..86fde0806c5beead2460a7394eddb8a40ccc9d97 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernCartDesign.java @@ -10,7 +10,7 @@ import de.tobias.playpad.design.FadeableColor; import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.conntent.play.Durationable; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.settings.Warning; import javafx.scene.paint.Color; import javafx.util.Duration; @@ -75,7 +75,7 @@ public class ModernCartDesign extends Design implements CartDesign, DesignColorA // Warn Handler -> Animation oder Blinken @Override - public void handleWarning(IPadViewControllerV2 controller, Warning warning, GlobalDesign layout) { + public void handleWarning(IPadViewController controller, Warning warning, GlobalDesign layout) { if (layout instanceof ModernGlobalDesign && ((ModernGlobalDesign) layout).isWarnAnimation()) { warnAnimation(controller, warning); } else { @@ -84,11 +84,11 @@ public class ModernCartDesign extends Design implements CartDesign, DesignColorA } @Override - public void stopWarning(IPadViewControllerV2 controller) { + public void stopWarning(IPadViewController controller) { ModernDesignAnimator.stopAnimation(controller); } - private void warnAnimation(IPadViewControllerV2 controller, Warning warning) { + private void warnAnimation(IPadViewController controller, Warning warning) { FadeableColor stopColor = new FadeableColor(this.backgroundColor.getColorHi(), this.backgroundColor.getColorLow()); FadeableColor playColor = new FadeableColor(this.playColor.getColorHi(), this.playColor.getColorLow()); diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernDesignAnimator.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernDesignAnimator.java index 95afa80a48bb990e3ab53ac4e7ae0d20fa1fed92..4d63d00aa52f650374858cd7debe77d3a8922612 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernDesignAnimator.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernDesignAnimator.java @@ -4,8 +4,8 @@ import java.util.HashMap; import de.tobias.playpad.PseudoClasses; import de.tobias.playpad.design.FadeableColor; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; @@ -23,7 +23,7 @@ public class ModernDesignAnimator { private static HashMap<Integer, Timeline> timelines = new HashMap<>(); - public static void animateFade(IPadViewControllerV2 padViewController, FadeableColor startColor, FadeableColor endColor, Duration duration) { + public static void animateFade(IPadViewController padViewController, FadeableColor startColor, FadeableColor endColor, Duration duration) { int index = padViewController.getPad().getIndex(); if (timelines.containsKey(index)) { @@ -57,7 +57,7 @@ public class ModernDesignAnimator { } - public static void animateWarn(IPadViewControllerV2 padViewController, FadeableColor startColor, FadeableColor endColor, Duration duration) { + public static void animateWarn(IPadViewController padViewController, FadeableColor startColor, FadeableColor endColor, Duration duration) { int index = padViewController.getPad().getIndex(); if (timelines.containsKey(index)) { @@ -95,7 +95,7 @@ public class ModernDesignAnimator { timelines.put(index, timeline); } - public static void stopAnimation(IPadViewControllerV2 controller) { + public static void stopAnimation(IPadViewController controller) { int index = controller.getPad().getIndex(); if (timelines.containsKey(index)) { @@ -103,8 +103,8 @@ public class ModernDesignAnimator { } } - public static void warnFlash(IPadViewControllerV2 controller) { - final IPadViewV2 view = controller.getView(); + public static void warnFlash(IPadViewController controller) { + final IPadView view = controller.getView(); try { while (true) { Platform.runLater(() -> diff --git a/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java b/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java index 1a274e589ecf717a8708ac2963d4fac6c4b77346..ce30da27f09ac92e0e5c9da1336d536899b6dc6e 100644 --- a/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java +++ b/PlayWall/src/de/tobias/playpad/design/modern/ModernGlobalDesign.java @@ -15,7 +15,7 @@ import de.tobias.playpad.design.GlobalDesign; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadSettings; import de.tobias.playpad.pad.conntent.play.Durationable; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +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; @@ -274,7 +274,7 @@ public class ModernGlobalDesign extends Design implements GlobalDesign, DesignCo // Warn Handler -> Animation oder Blinken @Override - public void handleWarning(IPadViewControllerV2 controller, Warning warning) { + public void handleWarning(IPadViewController controller, Warning warning) { if (isWarnAnimation) { warnAnimation(controller, warning); } else { @@ -283,11 +283,11 @@ public class ModernGlobalDesign extends Design implements GlobalDesign, DesignCo } @Override - public void stopWarning(IPadViewControllerV2 controller) { + public void stopWarning(IPadViewController controller) { ModernDesignAnimator.stopAnimation(controller); } - private void warnAnimation(IPadViewControllerV2 controller, Warning warning) { + private void warnAnimation(IPadViewController controller, Warning warning) { FadeableColor stopColor = new FadeableColor(this.backgroundColor.getColorHi(), this.backgroundColor.getColorLow()); FadeableColor playColor = new FadeableColor(this.playColor.getColorHi(), this.playColor.getColorLow()); diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java index fa69b00d01afe46c5bd318a4b9c764ab05cc9f63..9d9b3657b2436e236cf07934870d735adbc84ee4 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMainLayoutConnect.java @@ -3,7 +3,7 @@ package de.tobias.playpad.layout.desktop; import java.util.Stack; import de.tobias.playpad.Strings; -import de.tobias.playpad.pad.view.IPadViewV2; +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; @@ -22,7 +22,7 @@ public class DesktopMainLayoutConnect implements MainLayoutConnect { private DesktopMenuToolbarViewController desktopMenuToolbarViewController; - private Stack<IPadViewV2> recyclingStack; + private Stack<IPadView> recyclingStack; public DesktopMainLayoutConnect() { recyclingStack = new Stack<>(); @@ -47,7 +47,7 @@ public class DesktopMainLayoutConnect implements MainLayoutConnect { } @Override - public IPadViewV2 createPadView() { + public IPadView createPadView() { if (!recyclingStack.isEmpty()) { return recyclingStack.pop(); } @@ -55,7 +55,7 @@ public class DesktopMainLayoutConnect implements MainLayoutConnect { } @Override - public void recyclePadView(IPadViewV2 padView) { + public void recyclePadView(IPadView padView) { recyclingStack.push(padView); } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java index 0c1425ec0cfb123166db54fa25508b8ac2d0aeea..6fe5003cf5241fdb29778da90997145b657d2ab7 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java @@ -17,7 +17,7 @@ import de.tobias.playpad.Strings; import de.tobias.playpad.midi.Midi; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.PadStatus; -import de.tobias.playpad.pad.view.IPadViewV2; +import de.tobias.playpad.pad.view.IPadView; import de.tobias.playpad.project.Project; import de.tobias.playpad.project.ProjectNotFoundException; import de.tobias.playpad.project.ProjectReference; @@ -281,7 +281,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro // Disable Drag Mode wenn aktiv und diese Toolbar deaktiviert wird. if (dndModeMenuItem.isSelected()) { PadDragListener.setDndMode(false); - for (IPadViewV2 view : mainViewController.getPadViews()) { + for (IPadView view : mainViewController.getPadViews()) { view.enableDragAndDropDesignMode(false); } } @@ -405,13 +405,13 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro if (settings.isLiveMode() && settings.isLiveModeDrag() && currentProject.getActivePlayers() == 0) { PadDragListener.setDndMode(true); - for (IPadViewV2 view : mainViewController.getPadViews()) { + for (IPadView view : mainViewController.getPadViews()) { view.enableDragAndDropDesignMode(true); } } } else { PadDragListener.setDndMode(false); - for (IPadViewV2 view : mainViewController.getPadViews()) { + for (IPadView view : mainViewController.getPadViews()) { view.enableDragAndDropDesignMode(false); } } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java index 5d7a4f79555afdaa39ae577f8f71024c986776fa..72d74d982d3b7465e7abe24e6b4c0a58774e56ea 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadView.java @@ -8,8 +8,8 @@ import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.PadContentConnect; import de.tobias.playpad.pad.conntent.play.Pauseable; import de.tobias.playpad.pad.view.IPadContentView; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.view.EmptyPadView; import de.tobias.utils.ui.icon.FontAwesomeType; @@ -30,7 +30,7 @@ import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; -public class DesktopPadView implements IPadViewV2 { +public class DesktopPadView implements IPadView { private Label indexLabel; private Label loopLabel; @@ -164,7 +164,7 @@ public class DesktopPadView implements IPadViewV2 { } @Override - public IPadViewControllerV2 getViewController() { + public IPadViewController getViewController() { return controller; } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java index 2983ff620781c591f7ca584330e0568a4eed295e..0384a296e54b07d84224036dd1865e53d0717f57 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java @@ -20,8 +20,8 @@ import de.tobias.playpad.pad.listener.PadDurationListener; import de.tobias.playpad.pad.listener.PadLockedListener; import de.tobias.playpad.pad.listener.PadPositionListener; import de.tobias.playpad.pad.listener.PadStatusListener; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.settings.GlobalSettings; import de.tobias.playpad.settings.Profile; @@ -42,7 +42,7 @@ import javafx.stage.FileChooser.ExtensionFilter; import javafx.stage.Stage; import javafx.util.Duration; -public class DesktopPadViewController implements IPadViewControllerV2, EventHandler<ActionEvent> { +public class DesktopPadViewController implements IPadViewController, EventHandler<ActionEvent> { protected static final String CURRENT_PAGE_BUTTON = "current-page-button"; private static final String OPEN_FOLDER = "openFolder"; @@ -80,7 +80,7 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand } @Override - public IPadViewV2 getView() { + public IPadView getView() { return padView; } diff --git a/PlayWall/src/de/tobias/playpad/layout/touch/TouchMainLayoutConnect.java b/PlayWall/src/de/tobias/playpad/layout/touch/TouchMainLayoutConnect.java index a82f250d1e134b8e7ee25222b71f55b6b109a8f3..07126bc71dff9c20f93a7e497463b508d07d739e 100644 --- a/PlayWall/src/de/tobias/playpad/layout/touch/TouchMainLayoutConnect.java +++ b/PlayWall/src/de/tobias/playpad/layout/touch/TouchMainLayoutConnect.java @@ -3,7 +3,7 @@ package de.tobias.playpad.layout.touch; import java.util.Stack; import de.tobias.playpad.Strings; -import de.tobias.playpad.pad.view.IPadViewV2; +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; @@ -22,7 +22,7 @@ public class TouchMainLayoutConnect implements MainLayoutConnect { private TouchMenuToolbarViewController touchMainLayoutConnect; - private Stack<IPadViewV2> recyclingStack; + private Stack<IPadView> recyclingStack; public TouchMainLayoutConnect() { recyclingStack = new Stack<>(); @@ -48,7 +48,7 @@ public class TouchMainLayoutConnect implements MainLayoutConnect { } @Override - public IPadViewV2 createPadView() { + public IPadView createPadView() { if (!recyclingStack.isEmpty()) { return recyclingStack.pop(); } @@ -56,7 +56,7 @@ public class TouchMainLayoutConnect implements MainLayoutConnect { } @Override - public void recyclePadView(IPadViewV2 padView) { + public void recyclePadView(IPadView padView) { recyclingStack.push(padView); } diff --git a/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadView.java b/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadView.java index 068de5a19e7ab9fb4bbfd5713861c1dafb123479..8d68d5e6a08f27cc473292cf326b645f3d36c1ef 100644 --- a/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadView.java +++ b/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadView.java @@ -7,8 +7,8 @@ import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.PadContentConnect; import de.tobias.playpad.pad.view.IPadContentView; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.view.EmptyPadView; import de.tobias.utils.ui.icon.FontAwesomeType; @@ -28,7 +28,7 @@ import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; -public class TouchPadView implements IPadViewV2 { +public class TouchPadView implements IPadView { private Label indexLabel; private Label loopLabel; @@ -142,7 +142,7 @@ public class TouchPadView implements IPadViewV2 { } @Override - public IPadViewControllerV2 getViewController() { + public IPadViewController getViewController() { return controller; } diff --git a/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java b/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java index ff8e4684f0ca809be90bd850fc9f87679766061b..11ef9044b35d086c2f6dbcce2d21a24b8714d7e4 100644 --- a/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java +++ b/PlayWall/src/de/tobias/playpad/layout/touch/TouchPadViewController.java @@ -10,8 +10,8 @@ import de.tobias.playpad.pad.listener.PadDurationListener; import de.tobias.playpad.pad.listener.PadLockedListener; import de.tobias.playpad.pad.listener.PadPositionListener; import de.tobias.playpad.pad.listener.PadStatusListener; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.ProfileSettings; import de.tobias.playpad.viewcontroller.pad.PadDragListener; @@ -23,7 +23,7 @@ import javafx.scene.input.MouseEvent; import javafx.scene.input.TouchEvent; import javafx.util.Duration; -public class TouchPadViewController implements IPadViewControllerV2, EventHandler<Event> { +public class TouchPadViewController implements IPadViewController, EventHandler<Event> { protected static final String CURRENT_PAGE_BUTTON = "current-page-button"; private static final String DURATION_FORMAT = "%d:%02d"; @@ -61,7 +61,7 @@ public class TouchPadViewController implements IPadViewControllerV2, EventHandle } @Override - public IPadViewV2 getView() { + public IPadView getView() { return padView; } diff --git a/PlayWall/src/de/tobias/playpad/pad/listener/PadContentListener.java b/PlayWall/src/de/tobias/playpad/pad/listener/PadContentListener.java index cb47601c8299bedfd11902632276d79027408617..b27598ecfbac618ab3cce68b8a5172f19ac07f61 100644 --- a/PlayWall/src/de/tobias/playpad/pad/listener/PadContentListener.java +++ b/PlayWall/src/de/tobias/playpad/pad/listener/PadContentListener.java @@ -3,16 +3,16 @@ package de.tobias.playpad.pad.listener; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Durationable; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; public class PadContentListener implements ChangeListener<PadContent> { private Pad pad; - private IPadViewControllerV2 controller; + private IPadViewController controller; - public PadContentListener(IPadViewControllerV2 controller) { + public PadContentListener(IPadViewController controller) { this.controller = controller; } diff --git a/PlayWall/src/de/tobias/playpad/pad/listener/PadDurationListener.java b/PlayWall/src/de/tobias/playpad/pad/listener/PadDurationListener.java index 3947066c0fc29f35a9ea11a83212f6885cbf7b70..ce208522f99ec464cbe6996109ad0a4b3c9210d5 100644 --- a/PlayWall/src/de/tobias/playpad/pad/listener/PadDurationListener.java +++ b/PlayWall/src/de/tobias/playpad/pad/listener/PadDurationListener.java @@ -1,15 +1,15 @@ package de.tobias.playpad.pad.listener; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.util.Duration; public class PadDurationListener implements ChangeListener<Duration> { - private IPadViewControllerV2 controller; + private IPadViewController controller; - public PadDurationListener(IPadViewControllerV2 controller) { + public PadDurationListener(IPadViewController controller) { this.controller = controller; } diff --git a/PlayWall/src/de/tobias/playpad/pad/listener/PadLockedListener.java b/PlayWall/src/de/tobias/playpad/pad/listener/PadLockedListener.java index d568fc04ee64ec050ff7bbf6d6973a6fa8276b3f..702951b06dab11e634e5c4aec827a06c98638f4e 100644 --- a/PlayWall/src/de/tobias/playpad/pad/listener/PadLockedListener.java +++ b/PlayWall/src/de/tobias/playpad/pad/listener/PadLockedListener.java @@ -1,14 +1,14 @@ package de.tobias.playpad.pad.listener; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; public class PadLockedListener implements ChangeListener<Boolean> { - private IPadViewControllerV2 controller; + private IPadViewController controller; - public PadLockedListener(IPadViewControllerV2 controller) { + public PadLockedListener(IPadViewController controller) { this.controller = controller; } diff --git a/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java b/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java index 1f8b3486b4d2f35027cdffae79bc48ebf19749ed..f1ddd7d222840089fb73f7f63bbf8a69f6e783e2 100644 --- a/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java +++ b/PlayWall/src/de/tobias/playpad/pad/listener/PadPositionListener.java @@ -6,7 +6,7 @@ import de.tobias.playpad.pad.PadStatus; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.play.Durationable; import de.tobias.playpad.pad.conntent.play.Fadeable; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.Warning; import javafx.beans.value.ObservableValue; @@ -15,9 +15,9 @@ import javafx.util.Duration; public class PadPositionListener implements Runnable, IPadPositionListener { private Pad pad; - private IPadViewControllerV2 controller; + private IPadViewController controller; - public PadPositionListener(IPadViewControllerV2 controller) { + public PadPositionListener(IPadViewController controller) { this.controller = controller; } diff --git a/PlayWall/src/de/tobias/playpad/pad/listener/PadStatusListener.java b/PlayWall/src/de/tobias/playpad/pad/listener/PadStatusListener.java index 493292532f4621d3d1d1342548e01ac0364c1db4..3d24039f8c78b0ebb6b23015c9eece0d68957a49 100644 --- a/PlayWall/src/de/tobias/playpad/pad/listener/PadStatusListener.java +++ b/PlayWall/src/de/tobias/playpad/pad/listener/PadStatusListener.java @@ -2,15 +2,15 @@ package de.tobias.playpad.pad.listener; import de.tobias.playpad.PseudoClasses; import de.tobias.playpad.pad.PadStatus; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; public class PadStatusListener implements ChangeListener<PadStatus> { - private IPadViewControllerV2 controller; + private IPadViewController controller; - public PadStatusListener(IPadViewControllerV2 controller) { + public PadStatusListener(IPadViewController controller) { this.controller = controller; } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/AutoUpdateDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/AutoUpdateDialog.java index 03a49ae5b494cdf047f7b7c0534646224931efa3..f3d0fb89824c60c308730e1c0a365442544023d0 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/AutoUpdateDialog.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/AutoUpdateDialog.java @@ -6,22 +6,16 @@ import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.Strings; import de.tobias.playpad.update.Updatable; import de.tobias.playpad.update.UpdateRegistery; +import de.tobias.utils.ui.AdvancedDialog; import de.tobias.utils.util.Localization; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; -import javafx.scene.control.CheckBox; -import javafx.scene.control.Dialog; -import javafx.scene.control.Label; -import javafx.scene.layout.VBox; -import javafx.stage.Modality; -import javafx.stage.Stage; import javafx.stage.Window; -public class AutoUpdateDialog extends Dialog<ButtonType> { - - private CheckBox checkBox; +public class AutoUpdateDialog extends AdvancedDialog { public AutoUpdateDialog(Window owner) { + super(owner); List<Updatable> updates = UpdateRegistery.getAvailableUpdates(); StringBuilder builder = new StringBuilder(); @@ -32,26 +26,17 @@ public class AutoUpdateDialog extends Dialog<ButtonType> { builder.append("\n"); } - Label label = new Label(Localization.getString(Strings.UI_Dialog_AutoUpdate_Content, builder.toString())); - checkBox = new CheckBox(Localization.getString(Strings.UI_Dialog_AutoUpdate_Checkbox)); - VBox vBox = new VBox(14, label, checkBox); - + setTitle(Localization.getString(Strings.UI_Dialog_AutoUpdate_Title)); + setContent(Localization.getString(Strings.UI_Dialog_AutoUpdate_Content, builder.toString())); setHeaderText(Localization.getString(Strings.UI_Dialog_AutoUpdate_Header)); + setCheckboxText(Localization.getString(Strings.UI_Dialog_AutoUpdate_Checkbox)); + + setIcon(PlayPadMain.stageIcon); - ButtonType updateButton = new ButtonType(Localization.getString(Strings.UI_Dialog_AutoUpdate_Butto_Update), ButtonData.APPLY); - ButtonType cancelButton = new ButtonType(Localization.getString(Strings.UI_Dialog_AutoUpdate_Butto_Cancel), ButtonData.CANCEL_CLOSE); - - getDialogPane().setContent(vBox); - getDialogPane().getButtonTypes().addAll(updateButton, cancelButton); - - initOwner(owner); - initModality(Modality.WINDOW_MODAL); - setTitle(Localization.getString(Strings.UI_Dialog_AutoUpdate_Title)); - Stage dialogStage = (Stage) getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(dialogStage.getIcons()::add); - } + ButtonType updateButton = new ButtonType(Localization.getString(Strings.UI_Dialog_AutoUpdate_Button_Update), ButtonData.APPLY); + ButtonType cancelButton = new ButtonType(Localization.getString(Strings.UI_Dialog_AutoUpdate_Button_Cancel), ButtonData.CANCEL_CLOSE); - public boolean isIgnoreUpdate() { - return checkBox.isSelected(); + addButtonType(updateButton); + addButtonType(cancelButton); } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/SaveDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/SaveDialog.java new file mode 100644 index 0000000000000000000000000000000000000000..1cff79c55dd8a0c5d737e65d4af0d9ddf84f60ad --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/SaveDialog.java @@ -0,0 +1,31 @@ +package de.tobias.playpad.viewcontroller.dialog; + +import de.tobias.playpad.PlayPadMain; +import de.tobias.playpad.Strings; +import de.tobias.utils.ui.AdvancedDialog; +import de.tobias.utils.util.Localization; +import javafx.scene.control.ButtonBar.ButtonData; +import javafx.scene.control.ButtonType; +import javafx.stage.Window; + +public class SaveDialog extends AdvancedDialog { + + public SaveDialog(Window owner) { + super(owner); + + setTitle(Localization.getString(Strings.UI_Dialog_Save_Title)); + setContent(Localization.getString(Strings.UI_Dialog_Save_Content)); + setHeaderText(Localization.getString(Strings.UI_Dialog_Save_Header)); + setCheckboxText(Localization.getString(Strings.UI_Dialog_Save_Checkbox)); + setIcon(PlayPadMain.stageIcon); + + ButtonType saveButton = new ButtonType(Localization.getString(Strings.UI_Dialog_Save_Button_Yes), ButtonData.YES); + ButtonType notSaveButton = new ButtonType(Localization.getString(Strings.UI_Dialog_Save_Button_No), ButtonData.NO); + ButtonType cancelButton = new ButtonType(Localization.getString(Strings.UI_Dialog_Save_Button_Cancel), ButtonData.CANCEL_CLOSE); + + addButtonType(saveButton); + addButtonType(notSaveButton); + addButtonType(cancelButton); + } + +} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainMenuBarController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainMenuBarController.java deleted file mode 100644 index bd1b8923dc083c9525279a5934b7f9b388ca032f..0000000000000000000000000000000000000000 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainMenuBarController.java +++ /dev/null @@ -1,389 +0,0 @@ -package de.tobias.playpad.viewcontroller.main; - -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Optional; -import java.util.ResourceBundle; - -import de.tobias.playpad.AppUserInfoStrings; -import de.tobias.playpad.PlayPadMain; -import de.tobias.playpad.Strings; -import de.tobias.playpad.midi.Midi; -import de.tobias.playpad.pad.view.IPadViewController; -import de.tobias.playpad.project.Project; -import de.tobias.playpad.project.ProjectNotFoundException; -import de.tobias.playpad.project.ProjectReference; -import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileListener; -import de.tobias.playpad.settings.ProfileNotFoundException; -import de.tobias.playpad.settings.ProfileSettings; -import de.tobias.playpad.viewcontroller.SettingsTabViewController; -import de.tobias.playpad.viewcontroller.dialog.ErrorSummaryDialog; -import de.tobias.playpad.viewcontroller.dialog.ImportDialog; -import de.tobias.playpad.viewcontroller.dialog.NewProjectDialog; -import de.tobias.playpad.viewcontroller.dialog.PluginViewController; -import de.tobias.playpad.viewcontroller.dialog.PrintDialog; -import de.tobias.playpad.viewcontroller.dialog.ProfileViewController; -import de.tobias.playpad.viewcontroller.dialog.ProjectManagerDialog; -import de.tobias.playpad.viewcontroller.option.SettingsViewController; -import de.tobias.playpad.viewcontroller.pad.PadDragListener; -import de.tobias.utils.application.ApplicationInfo; -import de.tobias.utils.application.ApplicationUtils; -import de.tobias.utils.application.container.PathType; -import de.tobias.utils.util.Localization; -import de.tobias.utils.util.OS; -import de.tobias.utils.util.OS.OSType; -import de.tobias.utils.util.Worker; -import de.tobias.utils.util.net.FileUpload; -import javafx.application.Platform; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.control.Alert; -import javafx.scene.control.Alert.AlertType; -import javafx.scene.control.CheckMenuItem; -import javafx.scene.control.Menu; -import javafx.scene.control.MenuBar; -import javafx.scene.control.MenuItem; -import javafx.stage.Modality; -import javafx.stage.Stage; - -@Deprecated -public class MainMenuBarController implements EventHandler<ActionEvent>, Initializable, ProfileListener { - - @FXML private MenuBar menuBar; - @FXML private CheckMenuItem dndModeMenuItem; - @FXML private CheckMenuItem alwaysOnTopItem; - @FXML private CheckMenuItem fullScreenMenuItem; - @FXML private Menu recentOpenMenu; - @FXML private MenuItem profileMenu; - - @FXML private CheckMenuItem quickEditMenuItem; - @FXML private MenuItem settingsMenuItem; - - @FXML private Menu extensionMenu; - - // Open Windows - private SettingsViewController settingsViewController; - private MainViewController mvc; - - private ChangeListener<Boolean> lockedListener; - - @Override - public void initialize(URL location, ResourceBundle resources) { - menuBar.setUseSystemMenuBar(true); - - if (OS.getType() == OSType.MacOSX) { - menuBar.setMaxHeight(0); - } - - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); - Profile.registerListener(this); // Update, wenn sich das Profil ändert (remove Listener & add Listener) - - // Listener - lockedListener = new ChangeListener<Boolean>() { - - @Override - public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { - dndModeMenuItem.setDisable(newValue); - } - }; - profileSettings.lockedProperty().addListener(lockedListener); - lockedListener.changed(profileSettings.lockedProperty(), null, profileSettings.isLocked()); - } - - // Event - @FXML - private void newDocumentHandler(ActionEvent event) { - doAction(() -> - { - NewProjectDialog dialog = new NewProjectDialog(mvc.getStage()); - dialog.getStage().showAndWait(); - - Project project = dialog.getProject(); - if (project != null) { - mvc.setProject(project); - mvc.showPage(0); - } - }); - } - - @FXML - private void openDocumentHandler(ActionEvent event) { - doAction(() -> - { - ProjectManagerDialog view = new ProjectManagerDialog(mvc.getStage(), mvc.getProject()); - Optional<ProjectReference> result = view.showAndWait(); - if (result.isPresent()) { - ProjectReference ref = result.get(); - try { - Project project = Project.load(result.get(), true, ImportDialog.getInstance(mvc.getStage())); - mvc.setProject(project); - - mvc.showPage(0); - createRecentDocumentMenuItems(); - } catch (ProfileNotFoundException e) { - e.printStackTrace(); - mvc.showErrorMessage( - Localization.getString(Strings.Error_Profile_NotFound, ref.getProfileReference(), e.getLocalizedMessage())); - - // Neues Profile wählen - Profile profile = ImportDialog.getInstance(mvc.getStage()).getUnkownProfile(); - ref.setProfileReference(profile.getRef()); - } catch (ProjectNotFoundException e) { - e.printStackTrace(); - mvc.showErrorMessage(Localization.getString(Strings.Error_Project_NotFound, ref, e.getLocalizedMessage())); - } catch (Exception e) { - e.printStackTrace(); - mvc.showErrorMessage(Localization.getString(Strings.Error_Project_Open, ref, e.getLocalizedMessage())); - } - } - }); - } - - @FXML - private void saveMenuHandler(ActionEvent event) { - try { - mvc.getProject().save(); - mvc.notify(Localization.getString(Strings.Standard_File_Save), PlayPadMain.displayTimeMillis); - } catch (IOException e) { - mvc.showError(Localization.getString(Strings.Error_Project_Save)); - e.printStackTrace(); - } - } - - // Einstellungsmenu - @FXML - private void profileMenuHandler(ActionEvent event) { - doAction(() -> - { - ProfileViewController controller = new ProfileViewController(mvc.getStage(), mvc.getProject()); - controller.getStage().showAndWait(); - mvc.setTitle(); - }); - } - - @FXML - private void settingsHandler(ActionEvent event) { - Midi midi = Midi.getInstance(); - Project project = mvc.getProject(); - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); - - if (settings.isLiveMode() && settings.isLiveModeSettings() && project.getPlayedPlayers() > 0) { - mvc.showLiveInfo(); - return; - } - - if (settingsViewController == null) { - settingsViewController = new SettingsViewController(midi, mvc.getScreen(), mvc.getStage(), project, null) { - - @Override - public void updateData() { - midi.setListener(mvc.getMidiHandler()); - - boolean change = false; - for (SettingsTabViewController controller : tabs) { - if (controller.needReload()) { - change = true; - controller.reload(Profile.currentProfile(), project, mvc); - } - } - - if (change) { - PlayPadMain.getProgramInstance().getSettingsListener().forEach(l -> l.onChange(Profile.currentProfile())); - } - - settingsViewController = null; - mvc.getStage().toFront(); - } - }; - - settingsViewController.getStage().show(); - } else if (settingsViewController.getStage().isShowing()) { - settingsViewController.getStage().toFront(); - } - } - - @FXML - private void printMenuHandler(ActionEvent event) { - PrintDialog dialog = new PrintDialog(mvc.getProject(), mvc.getStage()); - dialog.getStage().show(); - } - - @FXML - private void alwaysOnTopItemHandler(ActionEvent event) { - mvc.getStage().setAlwaysOnTop(alwaysOnTopItem.isSelected()); - Profile.currentProfile().getProfileSettings().setWindowAlwaysOnTop(alwaysOnTopItem.isSelected()); - } - - @FXML - private void fullScreenMenuItemHandler(ActionEvent event) { - mvc.getStage().setFullScreen(fullScreenMenuItem.isSelected()); - } - - @FXML - private void dndModeHandler(ActionEvent event) { - if (dndModeMenuItem.isSelected()) { - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); - if (settings.isLiveMode() && settings.isLiveModeDrag() && mvc.getProject().getPlayedPlayers() > 0) { - mvc.showLiveInfo(); - } else { - PadDragListener.setDndMode(true); - for (IPadViewController view : mvc.padViewList) { - view.showDnDLayout(true); - } - } - } else { - PadDragListener.setDndMode(false); - for (IPadViewController view : mvc.padViewList) { - view.showDnDLayout(false); - } - } - - } - - @FXML - private void errorMenuHandler(ActionEvent event) { - ErrorSummaryDialog.getInstance().getStage().show(); - } - - @FXML - private void aboutMenuHandler(ActionEvent event) { - ApplicationInfo info = ApplicationUtils.getApplication().getInfo(); - String message = Localization.getString(Strings.UI_Dialog_Info_Content, info.getVersion(), info.getBuild(), info.getAuthor()); - mvc.showInfoMessage(message, Localization.getString(Strings.UI_Dialog_Info_Header, info.getName()), PlayPadMain.stageIcon.orElse(null)); - } - - @FXML - private void visiteWebsiteMenuHandler(ActionEvent event) { - String website = ApplicationUtils.getApplication().getInfo().getUserInfo().getString(AppUserInfoStrings.WEBSITE); - try { - Desktop.getDesktop().browse(new URI(website)); - } catch (IOException | URISyntaxException e) { - e.printStackTrace(); - } - } - - @FXML - private void sendErrorMenuItem(ActionEvent event) { - Alert alert = new Alert(AlertType.INFORMATION); - alert.initOwner(mvc.getStage()); - alert.initModality(Modality.WINDOW_MODAL); - Stage dialog = (Stage) alert.getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(dialog.getIcons()::add); - alert.setContentText(Localization.getString(Strings.UI_Dialog_Feedback_Content)); - alert.show(); - - Worker.runLater(() -> - { - try { - String response = FileUpload.fileUpload( - ApplicationUtils.getApplication().getInfo().getUserInfo().getString(AppUserInfoStrings.ERROR_URL), - ApplicationUtils.getApplication().getPath(PathType.LOG, "err.log").toFile()); - Platform.runLater(() -> alert.setContentText(response)); - } catch (IOException e) { - e.printStackTrace(); - } - }); - } - - @FXML - private void pluginMenuItemHandler(ActionEvent e) { - doAction(() -> - { - PluginViewController controller = new PluginViewController(mvc.getStage()); - controller.getStage().showAndWait(); - mvc.showPage(mvc.getPage()); - }); - } - - @Override - public void handle(ActionEvent event) { - if (event.getSource() instanceof MenuItem) { - // Zuletzt verwendete Projects - doAction(() -> - { - MenuItem item = (MenuItem) event.getSource(); - ProjectReference ref = (ProjectReference) item.getUserData(); - try { - // Speichern das alte Project in mvc.setProject(Project) - Project project = Project.load(ref, true, ImportDialog.getInstance(mvc.getStage())); - mvc.setProject(project); - mvc.showPage(0); - } catch (ProfileNotFoundException e) { - e.printStackTrace(); - mvc.showErrorMessage( - Localization.getString(Strings.Error_Profile_NotFound, ref.getProfileReference(), e.getLocalizedMessage())); - - // Neues Profile wählen - Profile profile = ImportDialog.getInstance(mvc.getStage()).getUnkownProfile(); - ref.setProfileReference(profile.getRef()); - } catch (ProjectNotFoundException e) { - e.printStackTrace(); - mvc.showErrorMessage(Localization.getString(Strings.Error_Project_NotFound, ref, e.getLocalizedMessage())); - } catch (Exception e) { - e.printStackTrace(); - mvc.showErrorMessage(Localization.getString(Strings.Error_Project_Open, ref, e.getLocalizedMessage())); - } - }); - } - } - - private void doAction(Runnable run) { - if (mvc.getProject().getPlayedPlayers() > 0 && Profile.currentProfile().getProfileSettings().isLiveMode()) { - mvc.showLiveInfo(); - } else { - run.run(); - } - } - - private final int LAST_DOCUMENT_LIMIT = 3; - - public void createRecentDocumentMenuItems() { - recentOpenMenu.getItems().clear(); - - String project = mvc.getProject().getRef().getName(); - - ProjectReference.getProjectsSorted().stream().filter(item -> !item.getName().equals(project)).limit(LAST_DOCUMENT_LIMIT).forEach(item -> - { - MenuItem menuItem = new MenuItem(item.toString()); - menuItem.setUserData(item); - menuItem.setOnAction(this); - recentOpenMenu.getItems().add(menuItem); - }); - } - - public void setMainViewController(MainViewController mvc) { - this.mvc = mvc; - } - - @Override - public void reloadSettings(Profile oldProfile, Profile currentProfile) { - if (oldProfile != null) { - oldProfile.getProfileSettings().lockedProperty().removeListener(lockedListener); - } - ProfileSettings profileSettings = currentProfile.getProfileSettings(); - profileSettings.lockedProperty().addListener(lockedListener); - lockedListener.changed(profileSettings.lockedProperty(), null, profileSettings.isLocked()); - } - - // Getter - - public CheckMenuItem getAlwaysOnTopItem() { - return alwaysOnTopItem; - } - - public Menu getExtensionMenu() { - return extensionMenu; - } - - public CheckMenuItem getFullScreenMenuItem() { - return fullScreenMenuItem; - } -} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainToolbarController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainToolbarController.java deleted file mode 100644 index b3ba148221022f94b46a5156cf6cf4b13f43587a..0000000000000000000000000000000000000000 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainToolbarController.java +++ /dev/null @@ -1,140 +0,0 @@ -package de.tobias.playpad.viewcontroller.main; - -import java.net.URL; -import java.util.ResourceBundle; - -import de.tobias.playpad.Strings; -import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileListener; -import de.tobias.playpad.settings.ProfileSettings; -import de.tobias.utils.ui.icon.FontAwesomeType; -import de.tobias.utils.ui.icon.FontIcon; -import de.tobias.utils.util.Localization; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; -import javafx.event.ActionEvent; -import javafx.event.EventHandler; -import javafx.fxml.FXML; -import javafx.fxml.Initializable; -import javafx.scene.Node; -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.Slider; -import javafx.scene.control.ToolBar; -import javafx.scene.layout.HBox; - -@Deprecated -public class MainToolbarController implements IMainToolbarViewController, Initializable, EventHandler<ActionEvent>, ProfileListener { - - @FXML private ToolBar toolbar; - @FXML private HBox toolbarHBox; - @FXML private HBox pageHBox; - - @FXML private HBox iconHbox; - private Label lockedLabel; - - @FXML private Label volumeDownLabel; - @FXML private Slider volumeSlider; - @FXML private Label volumeUpLabel; - - private MainViewController mainViewController; - - private ChangeListener<Boolean> lockedListener; - - @Override - public void initialize(URL location, ResourceBundle resources) { - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); - Profile.registerListener(this); - - // Listener - lockedListener = new ChangeListener<Boolean>() { - - @Override - public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { - if (newValue) { - iconHbox.getChildren().add(lockedLabel); - } else { - iconHbox.getChildren().remove(lockedLabel); - } - } - }; - profileSettings.lockedProperty().addListener(lockedListener); - - // HBox Child wird Max Width, subtract weil sonst zu groß für Toolbar - toolbarHBox.prefWidthProperty().bind(toolbar.widthProperty().subtract(25)); - toolbarHBox.prefHeightProperty().bind(toolbar.minHeightProperty()); - - // Info Icons - lockedLabel = new Label(); - lockedLabel.setGraphic(new FontIcon(FontAwesomeType.LOCK)); - lockedListener.changed(profileSettings.lockedProperty(), null, profileSettings.isLocked()); - - // Icons Volume - volumeDownLabel.setGraphic(new FontIcon("volume-item", FontAwesomeType.VOLUME_DOWN)); - volumeUpLabel.setGraphic(new FontIcon("volume-item", FontAwesomeType.VOLUME_UP)); - - volumeSlider.setOnScroll(ev -> - { - volumeSlider.setValue(volumeSlider.getValue() - ev.getDeltaY() * 0.001); - volumeSlider.setValue(volumeSlider.getValue() + ev.getDeltaX() * 0.001); - }); - } - - public void createPageButtons() { - pageHBox.getChildren().clear(); - for (int i = 0; i < Profile.currentProfile().getProfileSettings().getPageCount(); i++) { - Button item = new Button(Localization.getString(Strings.UI_Window_Main_PageButton, (i + 1))); - item.setUserData(i); - item.setFocusTraversable(false); - item.setOnAction(this); - pageHBox.getChildren().add(item); - } - } - - public HBox getPageHBox() { - return pageHBox; - } - - public HBox getToolbarHBox() { - return toolbarHBox; - } - - public Slider getVolumeSlider() { - return volumeSlider; - } - - public void setMainViewController(MainViewController mainViewController) { - this.mainViewController = mainViewController; - } - - @Override - public void handle(ActionEvent event) { - if (event.getSource() instanceof Button) { - // Page Buttons - Button item = (Button) event.getSource(); - int number = (int) item.getUserData(); - mainViewController.showPage(number); - } - } - - @Override - public void reloadSettings(Profile oldProfile, Profile currentProfile) { - if (oldProfile != null) { - oldProfile.getProfileSettings().lockedProperty().removeListener(lockedListener); - } - ProfileSettings profileSettings = currentProfile.getProfileSettings(); - profileSettings.lockedProperty().addListener(lockedListener); - lockedListener.changed(profileSettings.lockedProperty(), null, profileSettings.isLocked()); - } - - @Override - public void showIcon(Node node) { - iconHbox.getChildren().add(node); - } - - @Override - public void hideIcon(Node node) { - iconHbox.getChildren().remove(node); - } - -} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java index 04b6503415a452c82087fe5a35b09dc54c662b1d..c9a0df0fa17fd21bdb493a49d92f84ab90d0b264 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewController.java @@ -1,6 +1,5 @@ package de.tobias.playpad.viewcontroller.main; -import java.io.IOException; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -9,35 +8,32 @@ import java.util.Optional; import javax.sound.midi.MidiUnavailableException; import de.tobias.playpad.PlayPadMain; +import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; import de.tobias.playpad.action.Mapping; -import de.tobias.playpad.action.cartaction.CartAction; -import de.tobias.playpad.action.connect.CartActionConnect; -import de.tobias.playpad.action.feedback.ColorAssociator; -import de.tobias.playpad.action.feedback.DisplayableFeedbackColor; -import de.tobias.playpad.action.feedback.FeedbackMessage; -import de.tobias.playpad.action.mapper.Mapper; -import de.tobias.playpad.action.mapper.MapperFeedbackable; import de.tobias.playpad.action.mapper.listener.KeyboardHandler; import de.tobias.playpad.action.mapper.listener.MidiHandler; -import de.tobias.playpad.design.CartDesign; -import de.tobias.playpad.design.DesignColorAssociator; import de.tobias.playpad.design.GlobalDesign; +import de.tobias.playpad.layout.desktop.DesktopMainLayoutConnect; import de.tobias.playpad.midi.Midi; +import de.tobias.playpad.midi.MidiListener; import de.tobias.playpad.pad.Pad; -import de.tobias.playpad.pad.view.IPadViewController; -import de.tobias.playpad.pad.view.IPadViewV2; +import de.tobias.playpad.pad.view.IPadView; import de.tobias.playpad.plugin.WindowListener; import de.tobias.playpad.project.Project; +import de.tobias.playpad.project.ProjectSettings; +import de.tobias.playpad.registry.DefaultRegistry; +import de.tobias.playpad.registry.NoSuchComponentException; +import de.tobias.playpad.settings.GlobalSettings; import de.tobias.playpad.settings.Profile; import de.tobias.playpad.settings.ProfileListener; import de.tobias.playpad.settings.ProfileSettings; -import de.tobias.playpad.view.PadView; +import de.tobias.playpad.settings.keys.KeyCollection; import de.tobias.playpad.view.main.MainLayoutConnect; -import de.tobias.playpad.viewcontroller.IPadView; +import de.tobias.playpad.view.main.MainLayoutHandler; import de.tobias.playpad.viewcontroller.dialog.ErrorSummaryDialog; +import de.tobias.playpad.viewcontroller.dialog.SaveDialog; import de.tobias.playpad.viewcontroller.pad.PadDragListener; -import de.tobias.playpad.viewcontroller.pad.PadViewController; import de.tobias.utils.ui.BasicControllerSettings; import de.tobias.utils.ui.NotificationHandler; import de.tobias.utils.ui.ViewController; @@ -53,48 +49,39 @@ import javafx.event.EventType; import javafx.fxml.FXML; import javafx.scene.Group; import javafx.scene.Node; +import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; -import javafx.scene.control.Button; import javafx.scene.control.ButtonType; -import javafx.scene.control.Label; -import javafx.scene.control.MenuItem; -import javafx.scene.control.Slider; import javafx.scene.input.KeyCombination; import javafx.scene.input.KeyEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.RowConstraints; +import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Line; import javafx.stage.Modality; import javafx.stage.Screen; import javafx.stage.Stage; -// TODO Extract Color Adjust methodes public class MainViewController extends ViewController implements IMainViewController, NotificationHandler, ProfileListener { - private static final String CURRENT_PAGE_BUTTON = "current-page-button"; + private static final int FIRST_PAGE = 0; - // UI - @FXML protected MainMenuBarController menuBarController; - @FXML protected MainToolbarController toolbarController; + @FXML private VBox headerBox; @FXML private GridPane padGridPane; - @FXML private Label liveLabel; - @FXML private AnchorPane gridContainer; private NotificationPane notificationPane; - private ErrorSummaryDialog errorSummaryDialog; + private List<IPadView> padViews; - // Model - private Project project; - protected List<IPadViewController> padViewList = new ArrayList<>(); + private MenuToolbarViewController menuToolbarViewController; - // Current View Items - private int pageNumber; + private Project openProject; + private int currentPageShowing = -1; // Mapper private Midi midi; @@ -104,17 +91,44 @@ public class MainViewController extends ViewController implements IMainViewContr // Style private Color gridColor; - public MainViewController(Project project, List<WindowListener<IMainViewController>> listener) { + // Layout + private MainLayoutConnect mainLayout; + private List<MainLayoutHandler> layoutActions; + + // Listener + private VolumeChangeListener volumeChangeListener; + private LockedListener lockedListener; + private LayoutChangedListener layoutChangedListener; + + public MainViewController(List<WindowListener<IMainViewController>> listener) { super("mainView", "de/tobias/playpad/assets/view/main/", null, PlayPadMain.getUiResourceBundle()); + padViews = new ArrayList<>(); - // Include FXML Setup - toolbarController.setMainViewController(this); - menuBarController.setMainViewController(this); + // Init ErrorSummaryViewController + new ErrorSummaryDialog(getStage()); // Instance in ErrorSummaryViewController.getInstance() - padGridPane.setGridLinesVisible(true); + // Layout Init + layoutActions = new ArrayList<>(); + + // Init Listener + volumeChangeListener = new VolumeChangeListener(this); + lockedListener = new LockedListener(this); + layoutChangedListener = new LayoutChangedListener(); + initMapper(openProject); + + // Default Layout + setMainLayout(new DesktopMainLayoutConnect()); - // Settings Setup Profile.registerListener(this); + reloadSettings(null, Profile.currentProfile()); + + // Wenn sich die Toolbar ändert werden die Button neu erstellt. Das ist hier, weil es nur einmal als Listener da + // sein muss. Die Methode wird aber an unterschiedlichen stellen mehrmals aufgerufen + performLayoutDependendAction((oldToolbar, newToolbar) -> + { + if (menuToolbarViewController != null) + menuToolbarViewController.initPageButtons(); + }); /* * Gridline Color @@ -137,6 +151,18 @@ public class MainViewController extends ViewController implements IMainViewContr e.printStackTrace(); } + // Plugin Listener + listener.forEach(l -> + { + try { + l.onInit(this); + } catch (Exception e) { + e.printStackTrace(); + } + }); + } + + private void initMapper(Project project) { /* * Mapper Setup & Listener */ @@ -145,63 +171,72 @@ public class MainViewController extends ViewController implements IMainViewContr this.midi.setListener(midiHandler); this.keyboardHandler = new KeyboardHandler(project, this); - // Setup - errorSummaryDialog = new ErrorSummaryDialog(getStage()); - getStage().toFront(); - - // setup project - setProject(project); - - // Setup Settings - reloadSettings(null, Profile.currentProfile()); - - // Listener - listener.forEach(l -> l.onInit(this)); } @Override public void init() { padGridPane.getStyleClass().add("pad-grid"); - menuBarController.getExtensionMenu().setVisible(false); - - liveLabel.setVisible(false); - liveLabel.getStyleClass().add("live-label"); - notificationPane = new NotificationPane(padGridPane); notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK); gridContainer.getChildren().add(notificationPane); setAnchor(notificationPane, 0, 0, 0, 0); + } - getStage().fullScreenProperty().addListener((a, b, c) -> - { - menuBarController.getFullScreenMenuItem().setSelected(c); - }); - - // Lautstärke Veränderung - toolbarController.getVolumeSlider().valueProperty().addListener((a, b, c) -> - { - setPadVolume(c.doubleValue()); - }); + // main layout + public MainLayoutConnect getMainLayout() { + return mainLayout; } - public void setPadVolume(double volume) { - for (Pad pad : project.getPads().values()) { - if (pad != null) - pad.setMasterVolume(volume); - } + public void setMainLayout(MainLayoutConnect mainLayoutConnect) { + removePadsFromView(); + removePadViews(); + + this.mainLayout = mainLayoutConnect; + initMainLayout(); } - public void setTitle() { - if (project != null && Profile.currentProfile() != null) { - getStage().setTitle(Localization.getString(Strings.UI_Window_Main_Title, project.getRef().getName(), - Profile.currentProfile().getRef().getName())); - } else { - getStage().setTitle(Localization.getString(Strings.UI_Window_Main_Title)); + private void initMainLayout() { + ProfileSettings settings = Profile.currentProfile().getProfileSettings(); + + // Entfernt Volume listener + if (menuToolbarViewController != null) { + menuToolbarViewController.deinit(); + + menuToolbarViewController.getVolumeSlider().valueProperty().unbindBidirectional(settings.volumeProperty()); + menuToolbarViewController.getVolumeSlider().valueProperty().removeListener(volumeChangeListener); } + + // Erstellt Neue Toolbar + headerBox.getChildren().clear(); + MenuToolbarViewController newMenuToolbarViewController = mainLayout.createMenuToolbar(this); + headerBox.getChildren().add(newMenuToolbarViewController.getParent()); + + // Führt alle Listener für diesen neuen Controller aus, damit Buttons und co wieder erstellt werden können + layoutChangedListener.handle(layoutActions, this.menuToolbarViewController, newMenuToolbarViewController); + this.menuToolbarViewController = newMenuToolbarViewController; + + menuToolbarViewController.setOpenProject(openProject); + // Neue Volume listener + menuToolbarViewController.getVolumeSlider().valueProperty().bindBidirectional(settings.volumeProperty()); + menuToolbarViewController.getVolumeSlider().valueProperty().addListener(volumeChangeListener); + + // Keyboard Shortcuts + GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings(); + menuToolbarViewController.loadKeybinding(globalSettings.getKeyCollection()); + + // Update Locked Listener + ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + lockedListener.changed(profileSettings.lockedProperty(), !profileSettings.isLocked(), profileSettings.isLocked()); + + // Zeigt aktuelle Daten an + createPadViews(); + showPage(currentPageShowing); + loadUserCss(); } + // Stage Handling @Override public void initStage(Stage stage) { stage.fullScreenProperty().addListener((a, b, c) -> @@ -218,6 +253,7 @@ public class MainViewController extends ViewController implements IMainViewContr @Override protected void loadSettings(BasicControllerSettings settings) { + // Lädt die vorherigen Screen Positionen des Fenster List<Screen> screens = Screen.getScreensForRectangle(settings.getUserInfoAsDouble("x"), settings.getUserInfoAsDouble("y"), settings.width, settings.height); if (!screens.isEmpty()) { @@ -231,144 +267,176 @@ public class MainViewController extends ViewController implements IMainViewContr @Override protected void save(BasicControllerSettings settings) { + // Speichert die aktuelle Position des Fensters settings.addUserInfo("x", getStage().getX()); settings.addUserInfo("y", getStage().getY()); settings.width = getStage().getWidth(); settings.height = getStage().getHeight(); } - public void setProject(Project project) { - if (this.project != null) { - for (IPadViewController controller : padViewList) { - controller.unconnectPad(); - } - // Speichert das alte Projekt, bevor ein neues geladen wird - try { - this.project.save(); - } catch (IOException e) { - e.printStackTrace(); - showError(Localization.getString(Strings.Error_Project_Save, e.getLocalizedMessage())); - } - } - this.project = project; + @Override + public boolean closeRequest() { + ErrorSummaryDialog.getInstance().getStage().close(); - midiHandler.setProject(project); - keyboardHandler.setProject(project); - PadDragListener.setProject(project); + if (Profile.currentProfile() != null) { + ProfileSettings profilSettings = Profile.currentProfile().getProfileSettings(); + GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings(); - errorSummaryDialog.setProject(project); - menuBarController.createRecentDocumentMenuItems(); - setTitle(); - } + // Frag den Nutzer ob das Programm wirdklich geschlossen werden sol + // wenn ein Pad noch im Status Play ist + if (openProject.getActivePlayers() > 0 && globalSettings.isLiveMode()) { + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setContentText(Localization.getString(Strings.UI_Window_Main_CloseRequest)); - // GUI Helping Methoden - public void loadUserCss() { - Profile.currentProfile().currentLayout().applyCssMainView(this, getStage(), project); - applyColorsToMappers(); - } - - public void applyColorsToMappers() { - // Apply Layout to Mapper - List<CartAction> actions = Profile.currentProfile().getMappings().getActiveMapping().getActions(CartActionConnect.TYPE); - for (CartAction cartAction : actions) { - if (cartAction.isAutoFeedbackColors()) { - for (Mapper mapper : cartAction.getMappers()) { - if (mapper instanceof MapperFeedbackable) { - mapColorForMapper(cartAction, mapper); + alert.initOwner(getStage()); + alert.initModality(Modality.WINDOW_MODAL); + Stage alertStage = (Stage) alert.getDialogPane().getScene().getWindow(); + PlayPadMain.stageIcon.ifPresent(alertStage.getIcons()::add); + + Optional<ButtonType> result = alert.showAndWait(); + if (result.isPresent()) + if (result.get() != ButtonType.OK) + return false; + } + + // Save Dialog + if (globalSettings.isIgnoreSaveDialog()) { + saveProject(); + } else { + SaveDialog alert = new SaveDialog(getStage()); + Optional<ButtonType> result = alert.showAndWait(); + if (result.isPresent()) { + globalSettings.setIgnoreSaveDialog(alert.isSelected()); + ButtonType buttonType = result.get(); + if (buttonType == ButtonType.YES) { + // Projekt Speichern + saveProject(); + } else if (buttonType == ButtonType.CANCEL) { + return false; } } } - } - } - private void mapColorForMapper(CartAction cartAction, Mapper mapper) { - MapperFeedbackable feedbackable = (MapperFeedbackable) mapper; - if (feedbackable.supportFeedback() && mapper instanceof ColorAssociator) { - ColorAssociator colorAssociator = (ColorAssociator) mapper; + // Save Config - Its unabhängig vom Dialog, da es auch an anderen Stellen schon gespeichert wird + try { + if (Profile.currentProfile() != null) + Profile.currentProfile().save(); + } catch (Exception e) { + e.printStackTrace(); + showErrorMessage(Localization.getString(Strings.Error_Profile_Save)); + } - Pad pad = project.getPad(cartAction.getCart()); - Color layoutStdColor = null; - Color layoutEvColor = null; + // Mapper Clear Feedback + Profile.currentProfile().getMappings().getActiveMapping().clearFeedback(); - if (pad.isCustomLayout()) { - CartDesign layout = pad.getLayout(); - if (layout instanceof DesignColorAssociator) { - DesignColorAssociator associator = (DesignColorAssociator) layout; - layoutStdColor = associator.getAssociatedStandardColor(); - layoutEvColor = associator.getAssociatedEventColor(); - } - } else { - GlobalDesign layout = Profile.currentProfile().currentLayout(); - if (layout instanceof DesignColorAssociator) { - DesignColorAssociator associator = (DesignColorAssociator) layout; - layoutStdColor = associator.getAssociatedStandardColor(); - layoutEvColor = associator.getAssociatedEventColor(); + // MIDI Shutdown + // Der schließt MIDI, da er es auch öffnet und verantwortlich ist + if (profilSettings.isMidiActive()) { + try { + midi.close(); + } catch (MidiUnavailableException e1) { + e1.printStackTrace(); } } + } - if (layoutStdColor != null) { - DisplayableFeedbackColor associator = Mapper.searchColor(colorAssociator, FeedbackMessage.STANDARD, layoutStdColor); - colorAssociator.setColor(FeedbackMessage.STANDARD, associator.midiVelocity()); - } + if (getStage().isIconified()) { + getStage().setIconified(false); + } + + // Verbindung von Pad und PadView wird getrennt. Zudem wird bei PLAY + // oder PAUSE auf STOP gesetzt + removePadsFromView(); - if (layoutEvColor != null) { - DisplayableFeedbackColor associator = Mapper.searchColor(colorAssociator, FeedbackMessage.EVENT, layoutEvColor); - colorAssociator.setColor(FeedbackMessage.EVENT, associator.midiVelocity()); + saveSettings(); + return true; + } + + private void saveProject() { + try { + if (openProject.getRef() != null) { + openProject.save(); + System.out.println("Saved Project: " + openProject); } + } catch (Exception e) { + e.printStackTrace(); + showErrorMessage(Localization.getString(Strings.Error_Project_Save)); } } + // project /** - * Erstellt Constraints von GridView, Erstellt PadViews, Lädt CSS, Set Min Size vom Fendster + * Öffnet ein Project. Das akutelle project ist in PlayPadImpl gespeichert. + * + * @param project + * neues Project */ + public void openProject(Project project) { + removePadsFromView(); + + if (project != null) + removePadsFromView(); + + openProject = project; + + midiHandler.setProject(project); + keyboardHandler.setProject(project); + + midiHandler.setProject(project); + keyboardHandler.setProject(project); + PadDragListener.setProject(project); + ErrorSummaryDialog.getInstance().setProject(openProject); + + menuToolbarViewController.setOpenProject(openProject); + + createPadViews(); + showPage(FIRST_PAGE); + loadUserCss(); + updateWindowTitle(); + } + + // Pad, Pages + @Override public void createPadViews() { - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + if (openProject == null) { + return; + } + ProjectSettings projectSettings = openProject.getSettings(); // Table padGridPane.getColumnConstraints().clear(); - double xPercentage = 1.0 / (double) profileSettings.getColumns(); - for (int i = 0; i < profileSettings.getColumns(); i++) { + double xPercentage = 1.0 / (double) projectSettings.getColumns(); + for (int i = 0; i < projectSettings.getColumns(); i++) { ColumnConstraints c = new ColumnConstraints(); c.setPercentWidth(xPercentage * 100); padGridPane.getColumnConstraints().add(c); } padGridPane.getRowConstraints().clear(); - double yPercentage = 1.0 / (double) profileSettings.getRows(); - for (int i = 0; i < profileSettings.getRows(); i++) { + double yPercentage = 1.0 / (double) projectSettings.getRows(); + for (int i = 0; i < projectSettings.getRows(); i++) { RowConstraints c = new RowConstraints(); c.setPercentHeight(yPercentage * 100); padGridPane.getRowConstraints().add(c); } - // Pads - Remove Old PadViews - padGridPane.getChildren().removeIf(t -> - { - if (t instanceof PadView) { - ((PadView) t).getController().unconnectPad(); - return true; - } else { - return false; - } - }); - padViewList.clear(); + // Pads - Remove alte PadViews, falls noch welche vorhanden + if (!padViews.isEmpty()) + removePadViews(); // Neue PadViews - for (int y = 0; y < profileSettings.getRows(); y++) { - for (int x = 0; x < profileSettings.getColumns(); x++) { - IPadViewController controller = new PadViewController(); - IPadView node = controller.getParent(); - if (node instanceof PadView) { - padGridPane.add((Node) node, x, y); - padViewList.add(controller); - } + for (int y = 0; y < projectSettings.getRows(); y++) { + for (int x = 0; x < projectSettings.getColumns(); x++) { + IPadView padView = mainLayout.createPadView(); + padGridPane.add(padView.getRootNode(), x, y); + padViews.add(padView); } } // Min Size of window GlobalDesign currentLayout = Profile.currentProfile().currentLayout(); - double minWidth = currentLayout.getMinWidth(profileSettings.getColumns()); - double minHeight = currentLayout.getMinHeight(profileSettings.getRows()); + double minWidth = currentLayout.getMinWidth(projectSettings.getColumns()); + double minHeight = currentLayout.getMinHeight(projectSettings.getRows()); getStage().setMinWidth(minWidth); if (OS.getType() == OSType.MacOSX) { @@ -376,188 +444,174 @@ public class MainViewController extends ViewController implements IMainViewContr } else { getStage().setMinHeight(minHeight + 150); } + + menuToolbarViewController.initPageButtons(); + } + + private void removePadViews() { + padViews.forEach(view -> + { + padGridPane.getChildren().remove(view.getRootNode()); + mainLayout.recyclePadView(view); + }); + padViews.clear(); } /** - * Setzt die Pads in die Views und Cleared die alten Views. Lädt für die neuen Pads das Layout neu. - * - * @param newPage + * Zeigt die aktuellen Pads von einem Profil zu einer Seite in den entsprechenden Views an. */ - public synchronized void showPage(int newPage) { - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + private void addPadsToView() { + ProjectSettings settings = openProject.getSettings(); - if (!(newPage >= 0 && newPage < profileSettings.getPageCount())) { - return; - } + int index = currentPageShowing * settings.getRows() * settings.getColumns(); + for (int i = 0; i < settings.getRows() * settings.getColumns(); i++) { + if (padViews.size() > i) { + IPadView view = padViews.get(i); + Pad pad = openProject.getPad(index); - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); - if (settings.isLiveMode() && settings.isLiveModePage() && getProject().getPlayedPlayers() > 0) { - showLiveInfo(); - return; + view.getViewController().setupPad(pad); + } + index++; } + } - // Button in Toolbar - Button oldButton = (Button) toolbarController.getPageHBox().getChildren().get(pageNumber); // Der Aktuell - // andersfarbende - // Button - oldButton.getStyleClass().remove(CURRENT_PAGE_BUTTON); - - this.pageNumber = newPage; + /** + * Entfernt alle Pads auf den Views. + */ + private void removePadsFromView() { + // Clean old pads + for (IPadView padView : padViews) { + padView.getViewController().removePad(); + } + } - // alte Pads weg - padViewList.forEach(i -> i.unconnectPad()); + @Override + public boolean showPage(int page) { + if (openProject == null) { + return false; + } + ProjectSettings projectSettings = openProject.getSettings(); - // Neue Pads anzeigen - int index = pageNumber * profileSettings.getRows() * profileSettings.getColumns(); - for (int i = 0; i < profileSettings.getRows() * profileSettings.getColumns(); i++) { - if (padViewList.size() > i) { - IPadViewController view = padViewList.get(i); - view.setPad(project.getPad(index)); - } - index++; + if (page < 0 || page >= projectSettings.getPageCount()) { + return false; } - // Button in Toolbar anders färben - Button newButton = (Button) toolbarController.getPageHBox().getChildren().get(pageNumber); - newButton.getStyleClass().add(CURRENT_PAGE_BUTTON); + // Clean + removePadsFromView(); + this.currentPageShowing = page; + addPadsToView(); - // Handle Mapper - if (Profile.currentProfile() != null) { - Profile.currentProfile().getMappings().getActiveMapping().showFeedback(project, this); + if (menuToolbarViewController != null) { + menuToolbarViewController.highlightPageButton(page); } - - // GUI Styling - loadUserCss(); + return true; } - public Slider getVolumeSlider() { - return toolbarController.getVolumeSlider(); + @Override + public int getPage() { + return currentPageShowing; } - // TODO REDO @Override - public boolean closeRequest() { - if (errorSummaryDialog != null) - errorSummaryDialog.getStage().close(); + public void setGlobalVolume(double volume) { + if (openProject != null) { + for (Pad pad : openProject.getPads().values()) { + if (pad != null) + pad.setMasterVolume(volume); + } + } + } - if (Profile.currentProfile() != null) { - ProfileSettings profilSettings = Profile.currentProfile().getProfileSettings(); + // Settings + @Override + public void reloadSettings(Profile old, Profile currentProfile) { + createPadViews(); - // Frag den Nutzer ob das Programm wirdklich geschlossen werden sol - // wenn ein Pad noch im Status Play ist - if (project.getPlayedPlayers() > 0 && profilSettings.isLiveMode()) { - Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setContentText(Localization.getString(Strings.UI_Window_Main_CloseRequest)); + final DoubleProperty volumeFaderValueProperty = menuToolbarViewController.getVolumeSlider().valueProperty(); - alert.initOwner(getStage()); - alert.initModality(Modality.WINDOW_MODAL); - Stage alertStage = (Stage) alert.getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(alertStage.getIcons()::add); + if (old != null) { + // Unbind Volume Slider + volumeFaderValueProperty.unbindBidirectional(old.getProfileSettings().volumeProperty()); + volumeFaderValueProperty.removeListener(volumeChangeListener); - Optional<ButtonType> result = alert.showAndWait(); - if (result.isPresent()) - if (result.get() != ButtonType.OK) - return false; - } + // Clear Feedback on Devie (LaunchPad Light off) + old.getMappings().getActiveMapping().getActions().forEach(action -> action.clearFeedback()); - Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setContentText(Localization.getString(Strings.UI_Window_Main_SaveRequest)); - alert.getButtonTypes().setAll(ButtonType.CANCEL, ButtonType.NO, ButtonType.YES); - - Button yesButton = (Button) alert.getDialogPane().lookupButton(ButtonType.YES); - yesButton.defaultButtonProperty().bind(yesButton.focusedProperty()); - - Button noButton = (Button) alert.getDialogPane().lookupButton(ButtonType.NO); - noButton.defaultButtonProperty().bind(noButton.focusedProperty()); - - Button cancelButton = (Button) alert.getDialogPane().lookupButton(ButtonType.CANCEL); - cancelButton.defaultButtonProperty().bind(cancelButton.focusedProperty()); - - alert.initOwner(getStage()); - alert.initModality(Modality.WINDOW_MODAL); - Stage alertStage = (Stage) alert.getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(alertStage.getIcons()::add); - - Optional<ButtonType> result = alert.showAndWait(); - if (result.isPresent()) { - ButtonType buttonType = result.get(); - if (buttonType == ButtonType.YES) { - // Projekt Speichern - try { - if (project.getRef() != null) { - project.save(); - System.out.println("Saved Project: " + project); - } - } catch (Exception e) { - e.printStackTrace(); - showErrorMessage(Localization.getString(Strings.Error_Project_Save)); - } - } else if (buttonType == ButtonType.CANCEL) { - return false; - } - } + // LockedListener + old.getProfileSettings().lockedProperty().removeListener(lockedListener); + } - // Save Config - Its unabhängig vom Dialog, da es auch an anderen Stellen schon gespeichert wird - try { - if (Profile.currentProfile() != null) - Profile.currentProfile().save(); - } catch (Exception e) { - e.printStackTrace(); - showErrorMessage(Localization.getString(Strings.Error_Profile_Save)); - } + // Volume + volumeFaderValueProperty.bindBidirectional(currentProfile.getProfileSettings().volumeProperty()); + volumeFaderValueProperty.addListener(volumeChangeListener); - // Mapper Clear Feedback - Profile.currentProfile().getMappings().getActiveMapping().clearFeedback(); + final ProfileSettings profileSettings = currentProfile.getProfileSettings(); + final Mapping activeMapping = currentProfile.getMappings().getActiveMapping(); - // MIDI Shutdown - // Der schließt MIDI, da er es auch öffnet und verantwortlich ist - if (profilSettings.isMidiActive()) { - try { - midi.close(); - } catch (MidiUnavailableException e1) { - e1.printStackTrace(); - } - } - } + // LockedListener + profileSettings.lockedProperty().addListener(lockedListener); - if ( + // MIDI + if (profileSettings.isMidiActive() && profileSettings.getMidiDevice() != null) { + // Load known MIDI Device + Worker.runLater(() -> + { + loadMidiDevice(profileSettings.getMidiDevice()); + Profile.currentProfile().getMappings().getActiveMapping().adjustPadColorToMapper(openProject); - getStage().isIconified()) { - getStage().setIconified(false); + Platform.runLater(() -> + { + // Handle Mapper + if (Profile.currentProfile() != null) { + activeMapping.initFeedback(); + activeMapping.showFeedback(openProject); + } + }); + }); } - // Verbindung von Pad und PadView wird getrennt. Zudem wird bei PLAY - // oder PAUSE auf STOP gesetzt - padViewList.forEach(padView -> padView.unconnectPad()); + try { + DefaultRegistry<MainLayoutConnect> registry = PlayPadPlugin.getRegistryCollection().getMainLayouts(); + MainLayoutConnect connect = registry.getComponent(currentProfile.getProfileSettings().getMainLayoutType()); + setMainLayout(connect); + } catch (NoSuchComponentException e) { + // TODO Error Handling + e.printStackTrace(); + } - saveSettings(); - return true; + loadUserCss(); + if (old != null && currentProfile != null) { + showPage(currentPageShowing); + } } - /* - * MIDI - */ + @Override + public void loadKeybinding(KeyCollection keys) { + if (menuToolbarViewController != null) { + menuToolbarViewController.loadKeybinding(keys); + } + } - /** - * Init MIDI Device by using the Midi Class and show some feedback the user. - * - * @param name - * Device Name - * - * @see Midi#lookupMidiDevice(String) - */ - private void loadMidiDevice(String name) { + @Override + public void setGridColor(Color color) { + this.gridColor = color; try { - midi.lookupMidiDevice(name); - notificationPane.showAndHide(Localization.getString(Strings.Info_Midi_Device_Connected, name), PlayPadMain.displayTimeMillis); - } catch (NullPointerException e) { - showError(Localization.getString(Strings.Error_Midi_Device_Unavailible, name)); - } catch (IllegalArgumentException | MidiUnavailableException e) { - showError(Localization.getString(Strings.Error_Midi_Device_Busy, e.getLocalizedMessage())); + Field field = padGridPane.getClass().getDeclaredField("gridLines"); + field.setAccessible(true); + Group group = (Group) field.get(padGridPane); + if (group != null) { + for (Node node : group.getChildren()) { + if (node instanceof Line) { + ((Line) node).setStroke(gridColor); + } + } + } + } catch (Exception e) { e.printStackTrace(); } } + // Notification @Override public void notify(String text, long duration) { if (Platform.isFxApplicationThread()) { @@ -594,152 +648,85 @@ public class MainViewController extends ViewController implements IMainViewContr } } + // Utils @Override - public int getPage() { - return pageNumber; - } - - private boolean shown = false; - - public void showLiveInfo() { - if (!shown) { - toolbarController.getToolbarHBox().setOpacity(0.5); - liveLabel.setVisible(true); - shown = true; - Worker.runLater(() -> - { - try { - Thread.sleep(PlayPadMain.displayTimeMillis * 2); - } catch (Exception e) {} - Platform.runLater(() -> - { - toolbarController.getToolbarHBox().setOpacity(1); - liveLabel.setVisible(false); - shown = false; - }); - }); - } + public void registerKeyboardListener(EventType<KeyEvent> eventType, EventHandler<KeyEvent> listener) { + getParent().getScene().addEventHandler(eventType, listener); } @Override - public void reloadSettings(Profile old, Profile currentProfile) { - final DoubleProperty valueProperty = toolbarController.getVolumeSlider().valueProperty(); - - if (old != null) { - // Unbind Volume Slider - valueProperty.unbindBidirectional(old.getProfileSettings().volumeProperty()); - // Clear Feedback on Devie (LaunchPad Light off) - old.getMappings().getActiveMapping().getActions().forEach(action -> action.clearFeedback()); - } - - // Pad iund Page GUI - createPadViews(); - toolbarController.createPageButtons(); - - // Volume - valueProperty.bindBidirectional(currentProfile.getProfileSettings().volumeProperty()); - - final ProfileSettings profilSettings = currentProfile.getProfileSettings(); - final Mapping activeMapping = currentProfile.getMappings().getActiveMapping(); - - // MIDI - if (profilSettings.isMidiActive() && profilSettings.getMidiDevice() != null) { - // Load known MIDI Device - Worker.runLater(() -> - { - loadMidiDevice(profilSettings.getMidiDevice()); + public void loadUserCss() { + Scene scene = getStage().getScene(); - applyColorsToMappers(); + // Clear Old + scene.getStylesheets().clear(); - Platform.runLater(() -> - { - // Handle Mapper - if (Profile.currentProfile() != null) { - activeMapping.initFeedback(); - activeMapping.showFeedback(project); - } - }); - }); + // Layout Spezifisches CSS (Base) + if (mainLayout.getStylesheet() != null) { + scene.getStylesheets().add(mainLayout.getStylesheet()); } - // WINDOW Settings - menuBarController.getAlwaysOnTopItem().setSelected(profilSettings.isWindowAlwaysOnTop()); - getStage().setAlwaysOnTop(profilSettings.isWindowAlwaysOnTop()); - - setTitle(); - showPage(pageNumber); // Show Mapper Feedback und apply css und zeigt pads - } - - public Project getProject() { - return project; - } - - public MidiHandler getMidiHandler() { - return midiHandler; - } + // design spezific css + if (openProject != null) { + Profile.currentProfile().currentLayout().applyCssMainView(this, getStage(), openProject); + } - public MainToolbarController getToolbarController() { - return toolbarController; + Profile.currentProfile().getMappings().getActiveMapping().adjustPadColorToMapper(openProject); } - // Plugins /** - * Fügt ein MenuItem ins Menu hinzu + * Init MIDI Device by using the Midi Class and show some feedback the user. * - * @param item + * @param name + * Device Name * - * @since 2.0.0 + * @see Midi#lookupMidiDevice(String) */ - public void addMenuItem(MenuItem item) { - menuBarController.getExtensionMenu().getItems().add(item); - if (!menuBarController.getExtensionMenu().isVisible()) { - menuBarController.getExtensionMenu().setVisible(true); + private void loadMidiDevice(String name) { + try { + midi.lookupMidiDevice(name); + notificationPane.showAndHide(Localization.getString(Strings.Info_Midi_Device_Connected, name), PlayPadMain.displayTimeMillis); + } catch (NullPointerException e) { + e.printStackTrace(); + showError(Localization.getString(Strings.Error_Midi_Device_Unavailible, name)); + } catch (IllegalArgumentException | MidiUnavailableException e) { + showError(Localization.getString(Strings.Error_Midi_Device_Busy, e.getLocalizedMessage())); + e.printStackTrace(); } } - public void setGridColor(Color gridColor) { - this.gridColor = gridColor; - try { - Field field = padGridPane.getClass().getDeclaredField("gridLines"); - field.setAccessible(true); - Group group = (Group) field.get(padGridPane); - if (group != null) { - for (Node node : group.getChildren()) { - if (node instanceof Line) { - ((Line) node).setStroke(gridColor); - } - } - } - } catch (Exception e) { - e.printStackTrace(); + public void updateWindowTitle() { + if (openProject != null && Profile.currentProfile() != null) { + getStage().setTitle(Localization.getString(Strings.UI_Window_Main_Title, openProject.getRef().getName(), + Profile.currentProfile().getRef().getName())); + } else { + getStage().setTitle(Localization.getString(Strings.UI_Window_Main_Title)); } } @Override - public void registerKeyboardListener(EventType<KeyEvent> eventType, EventHandler<KeyEvent> listener) { - getParent().getScene().addEventHandler(eventType, listener); + public List<IPadView> getPadViews() { + return padViews; } @Override - public List<IPadViewV2> getPadViews() { - // TODO Auto-generated method stub - return null; + public MidiListener getMidiHandler() { + return midiHandler; } @Override public MenuToolbarViewController getMenuToolbarController() { - // TODO Auto-generated method stub - return null; + return menuToolbarViewController; } @Override - public void setMainLayout(MainLayoutConnect mainLayoutConnect) { - // TODO Auto-generated method stub + public void performLayoutDependendAction(MainLayoutHandler runnable) { + runnable.handle(null, menuToolbarViewController); + layoutActions.add(runnable); } @Override - public void performLayoutDependendAction(Runnable runnable) { - // TODO Auto-generated method stub - + public NotificationPane getNotificationPane() { + return notificationPane; } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java deleted file mode 100644 index 0ce42d323fb9801a5f4ce669bcc701e0d819ea97..0000000000000000000000000000000000000000 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java +++ /dev/null @@ -1,739 +0,0 @@ -package de.tobias.playpad.viewcontroller.main; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import javax.sound.midi.MidiUnavailableException; - -import de.tobias.playpad.PlayPadMain; -import de.tobias.playpad.PlayPadPlugin; -import de.tobias.playpad.Strings; -import de.tobias.playpad.action.Mapping; -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.midi.Midi; -import de.tobias.playpad.midi.MidiListener; -import de.tobias.playpad.pad.Pad; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.plugin.WindowListener; -import de.tobias.playpad.project.Project; -import de.tobias.playpad.project.ProjectSettings; -import de.tobias.playpad.registry.DefaultRegistry; -import de.tobias.playpad.registry.NoSuchComponentException; -import de.tobias.playpad.settings.GlobalSettings; -import de.tobias.playpad.settings.Profile; -import de.tobias.playpad.settings.ProfileListener; -import de.tobias.playpad.settings.ProfileSettings; -import de.tobias.playpad.settings.keys.KeyCollection; -import de.tobias.playpad.view.main.MainLayoutConnect; -import de.tobias.playpad.view.main.MainLayoutHandler; -import de.tobias.playpad.viewcontroller.dialog.ErrorSummaryDialog; -import de.tobias.playpad.viewcontroller.pad.PadDragListener; -import de.tobias.utils.ui.BasicControllerSettings; -import de.tobias.utils.ui.NotificationHandler; -import de.tobias.utils.ui.ViewController; -import de.tobias.utils.ui.scene.NotificationPane; -import de.tobias.utils.util.Localization; -import de.tobias.utils.util.OS; -import de.tobias.utils.util.OS.OSType; -import de.tobias.utils.util.Worker; -import javafx.application.Platform; -import javafx.beans.property.DoubleProperty; -import javafx.event.EventHandler; -import javafx.event.EventType; -import javafx.fxml.FXML; -import javafx.scene.Group; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.Alert; -import javafx.scene.control.Alert.AlertType; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonType; -import javafx.scene.input.KeyCombination; -import javafx.scene.input.KeyEvent; -import javafx.scene.layout.AnchorPane; -import javafx.scene.layout.ColumnConstraints; -import javafx.scene.layout.GridPane; -import javafx.scene.layout.RowConstraints; -import javafx.scene.layout.VBox; -import javafx.scene.paint.Color; -import javafx.scene.shape.Line; -import javafx.stage.Modality; -import javafx.stage.Screen; -import javafx.stage.Stage; - -public class MainViewControllerV2 extends ViewController implements IMainViewController, NotificationHandler, ProfileListener { - - private static final int FIRST_PAGE = 0; - - @FXML private VBox headerBox; - @FXML private GridPane padGridPane; - - @FXML private AnchorPane gridContainer; - private NotificationPane notificationPane; - - private List<IPadViewV2> padViews; - - private MenuToolbarViewController menuToolbarViewController; - - private Project openProject; - private int currentPageShowing = -1; - - // Mapper - private Midi midi; - private MidiHandler midiHandler; - private KeyboardHandler keyboardHandler; - - // Style - private Color gridColor; - - // Layout - private MainLayoutConnect mainLayout; - private List<MainLayoutHandler> layoutActions; - - // Listener - private VolumeChangeListener volumeChangeListener; - private LockedListener lockedListener; - private LayoutChangedListener layoutChangedListener; - - public MainViewControllerV2(List<WindowListener<IMainViewController>> listener) { - super("mainViewV2", "de/tobias/playpad/assets/view/main/", null, PlayPadMain.getUiResourceBundle()); - padViews = new ArrayList<>(); - - // Init ErrorSummaryViewController - new ErrorSummaryDialog(getStage()); // Instance in ErrorSummaryViewController.getInstance() - - // Layout Init - layoutActions = new ArrayList<>(); - - // Init Listener - volumeChangeListener = new VolumeChangeListener(this); - lockedListener = new LockedListener(this); - layoutChangedListener = new LayoutChangedListener(); - initMapper(openProject); - - // Default Layout - setMainLayout(new DesktopMainLayoutConnect()); - - Profile.registerListener(this); - reloadSettings(null, Profile.currentProfile()); - - // Wenn sich die Toolbar ändert werden die Button neu erstellt. Das ist hier, weil es nur einmal als Listener da - // sein muss. Die Methode wird aber an unterschiedlichen stellen mehrmals aufgerufen - performLayoutDependendAction((oldToolbar, newToolbar) -> - { - if (menuToolbarViewController != null) - menuToolbarViewController.initPageButtons(); - }); - - /* - * Gridline Color - */ - try { - Field field = padGridPane.getClass().getDeclaredField("gridLines"); - field.setAccessible(true); - Group group = (Group) field.get(padGridPane); - if (group != null) { - group.getChildren().addListener((javafx.collections.ListChangeListener.Change<? extends Node> c) -> - { - for (Node node : group.getChildren()) { - if (node instanceof Line) { - ((Line) node).setStroke(gridColor); - } - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - } - - // Plugin Listener - listener.forEach(l -> - { - try { - l.onInit(this); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - - private void initMapper(Project project) { - /* - * Mapper Setup & Listener - */ - this.midi = Midi.getInstance(); - this.midiHandler = new MidiHandler(midi, this, project); - this.midi.setListener(midiHandler); - this.keyboardHandler = new KeyboardHandler(project, this); - - } - - @Override - public void init() { - padGridPane.getStyleClass().add("pad-grid"); - - notificationPane = new NotificationPane(padGridPane); - notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK); - - gridContainer.getChildren().add(notificationPane); - setAnchor(notificationPane, 0, 0, 0, 0); - } - - // main layout - public MainLayoutConnect getMainLayout() { - return mainLayout; - } - - public void setMainLayout(MainLayoutConnect mainLayoutConnect) { - removePadsFromView(); - removePadViews(); - - this.mainLayout = mainLayoutConnect; - initMainLayout(); - } - - private void initMainLayout() { - ProfileSettings settings = Profile.currentProfile().getProfileSettings(); - - // Entfernt Volume listener - if (menuToolbarViewController != null) { - menuToolbarViewController.deinit(); - - menuToolbarViewController.getVolumeSlider().valueProperty().unbindBidirectional(settings.volumeProperty()); - menuToolbarViewController.getVolumeSlider().valueProperty().removeListener(volumeChangeListener); - } - - // Erstellt Neue Toolbar - headerBox.getChildren().clear(); - MenuToolbarViewController newMenuToolbarViewController = mainLayout.createMenuToolbar(this); - headerBox.getChildren().add(newMenuToolbarViewController.getParent()); - - // Führt alle Listener für diesen neuen Controller aus, damit Buttons und co wieder erstellt werden können - layoutChangedListener.handle(layoutActions, this.menuToolbarViewController, newMenuToolbarViewController); - this.menuToolbarViewController = newMenuToolbarViewController; - - menuToolbarViewController.setOpenProject(openProject); - // Neue Volume listener - menuToolbarViewController.getVolumeSlider().valueProperty().bindBidirectional(settings.volumeProperty()); - menuToolbarViewController.getVolumeSlider().valueProperty().addListener(volumeChangeListener); - - // Keyboard Shortcuts - GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings(); - menuToolbarViewController.loadKeybinding(globalSettings.getKeyCollection()); - - // Update Locked Listener - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); - lockedListener.changed(profileSettings.lockedProperty(), !profileSettings.isLocked(), profileSettings.isLocked()); - - // Zeigt aktuelle Daten an - createPadViews(); - showPage(currentPageShowing); - loadUserCss(); - } - - // Stage Handling - @Override - public void initStage(Stage stage) { - stage.fullScreenProperty().addListener((a, b, c) -> - { - if (Profile.currentProfile() != null) - stage.setAlwaysOnTop(Profile.currentProfile().getProfileSettings().isWindowAlwaysOnTop()); - }); - - PlayPadMain.stageIcon.ifPresent(stage.getIcons()::add); - stage.setFullScreenExitKeyCombination(KeyCombination.keyCombination(KeyCombination.SHIFT_DOWN + "+Esc")); - stage.setTitle(Localization.getString(Strings.UI_Window_Main_Title)); - stage.show(); - } - - @Override - protected void loadSettings(BasicControllerSettings settings) { - // Lädt die vorherigen Screen Positionen des Fenster - List<Screen> screens = Screen.getScreensForRectangle(settings.getUserInfoAsDouble("x"), settings.getUserInfoAsDouble("y"), - settings.width, settings.height); - if (!screens.isEmpty()) { - getStage().setX(settings.getUserInfoAsDouble("x")); - getStage().setY(settings.getUserInfoAsDouble("y")); - } - - getStage().setWidth(settings.width); - getStage().setHeight(settings.height); - } - - @Override - protected void save(BasicControllerSettings settings) { - // Speichert die aktuelle Position des Fensters - settings.addUserInfo("x", getStage().getX()); - settings.addUserInfo("y", getStage().getY()); - settings.width = getStage().getWidth(); - settings.height = getStage().getHeight(); - } - - @Override - public boolean closeRequest() { - ErrorSummaryDialog.getInstance().getStage().close(); - - if (Profile.currentProfile() != null) { - ProfileSettings profilSettings = Profile.currentProfile().getProfileSettings(); - GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings(); - - // Frag den Nutzer ob das Programm wirdklich geschlossen werden sol - // wenn ein Pad noch im Status Play ist - if (openProject.getActivePlayers() > 0 && globalSettings.isLiveMode()) { - Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setContentText(Localization.getString(Strings.UI_Window_Main_CloseRequest)); - - alert.initOwner(getStage()); - alert.initModality(Modality.WINDOW_MODAL); - Stage alertStage = (Stage) alert.getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(alertStage.getIcons()::add); - - Optional<ButtonType> result = alert.showAndWait(); - if (result.isPresent()) - if (result.get() != ButtonType.OK) - return false; - } - - Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setContentText(Localization.getString(Strings.UI_Window_Main_SaveRequest)); - alert.getButtonTypes().setAll(ButtonType.CANCEL, ButtonType.NO, ButtonType.YES); - - Button yesButton = (Button) alert.getDialogPane().lookupButton(ButtonType.YES); - yesButton.defaultButtonProperty().bind(yesButton.focusedProperty()); - - Button noButton = (Button) alert.getDialogPane().lookupButton(ButtonType.NO); - noButton.defaultButtonProperty().bind(noButton.focusedProperty()); - - Button cancelButton = (Button) alert.getDialogPane().lookupButton(ButtonType.CANCEL); - cancelButton.defaultButtonProperty().bind(cancelButton.focusedProperty()); - - alert.initOwner(getStage()); - alert.initModality(Modality.WINDOW_MODAL); - Stage alertStage = (Stage) alert.getDialogPane().getScene().getWindow(); - PlayPadMain.stageIcon.ifPresent(alertStage.getIcons()::add); - - Optional<ButtonType> result = alert.showAndWait(); - if (result.isPresent()) { - ButtonType buttonType = result.get(); - if (buttonType == ButtonType.YES) { - // Projekt Speichern - try { - if (openProject.getRef() != null) { - openProject.save(); - System.out.println("Saved Project: " + openProject); - } - } catch (Exception e) { - e.printStackTrace(); - showErrorMessage(Localization.getString(Strings.Error_Project_Save)); - } - } else if (buttonType == ButtonType.CANCEL) { - return false; - } - } - - // Save Config - Its unabhängig vom Dialog, da es auch an anderen Stellen schon gespeichert wird - try { - if (Profile.currentProfile() != null) - Profile.currentProfile().save(); - } catch (Exception e) { - e.printStackTrace(); - showErrorMessage(Localization.getString(Strings.Error_Profile_Save)); - } - - // Mapper Clear Feedback - Profile.currentProfile().getMappings().getActiveMapping().clearFeedback(); - - // MIDI Shutdown - // Der schließt MIDI, da er es auch öffnet und verantwortlich ist - if (profilSettings.isMidiActive()) { - try { - midi.close(); - } catch (MidiUnavailableException e1) { - e1.printStackTrace(); - } - } - } - - if (getStage().isIconified()) { - getStage().setIconified(false); - } - - // Verbindung von Pad und PadView wird getrennt. Zudem wird bei PLAY - // oder PAUSE auf STOP gesetzt - removePadsFromView(); - - saveSettings(); - return true; - } - - // project - /** - * Öffnet ein Project. Das akutelle project ist in PlayPadImpl gespeichert. - * - * @param project - * neues Project - */ - public void openProject(Project project) { - removePadsFromView(); - - if (project != null) - removePadsFromView(); - - openProject = project; - - midiHandler.setProject(project); - keyboardHandler.setProject(project); - - midiHandler.setProject(project); - keyboardHandler.setProject(project); - PadDragListener.setProject(project); - ErrorSummaryDialog.getInstance().setProject(openProject); - - menuToolbarViewController.setOpenProject(openProject); - - createPadViews(); - showPage(FIRST_PAGE); - loadUserCss(); - updateWindowTitle(); - } - - // Pad, Pages - @Override - public void createPadViews() { - if (openProject == null) { - return; - } - ProjectSettings projectSettings = openProject.getSettings(); - - // Table - padGridPane.getColumnConstraints().clear(); - double xPercentage = 1.0 / (double) projectSettings.getColumns(); - for (int i = 0; i < projectSettings.getColumns(); i++) { - ColumnConstraints c = new ColumnConstraints(); - c.setPercentWidth(xPercentage * 100); - padGridPane.getColumnConstraints().add(c); - } - - padGridPane.getRowConstraints().clear(); - double yPercentage = 1.0 / (double) projectSettings.getRows(); - for (int i = 0; i < projectSettings.getRows(); i++) { - RowConstraints c = new RowConstraints(); - c.setPercentHeight(yPercentage * 100); - padGridPane.getRowConstraints().add(c); - } - - // Pads - Remove alte PadViews, falls noch welche vorhanden - if (!padViews.isEmpty()) - removePadViews(); - - // Neue PadViews - for (int y = 0; y < projectSettings.getRows(); y++) { - for (int x = 0; x < projectSettings.getColumns(); x++) { - IPadViewV2 padView = mainLayout.createPadView(); - padGridPane.add(padView.getRootNode(), x, y); - padViews.add(padView); - } - } - - // Min Size of window - GlobalDesign currentLayout = Profile.currentProfile().currentLayout(); - double minWidth = currentLayout.getMinWidth(projectSettings.getColumns()); - double minHeight = currentLayout.getMinHeight(projectSettings.getRows()); - - getStage().setMinWidth(minWidth); - if (OS.getType() == OSType.MacOSX) { - getStage().setMinHeight(minHeight + 100); - } else { - getStage().setMinHeight(minHeight + 150); - } - - menuToolbarViewController.initPageButtons(); - } - - private void removePadViews() { - padViews.forEach(view -> - { - padGridPane.getChildren().remove(view.getRootNode()); - mainLayout.recyclePadView(view); - }); - padViews.clear(); - } - - /** - * Zeigt die aktuellen Pads von einem Profil zu einer Seite in den entsprechenden Views an. - */ - private void addPadsToView() { - ProjectSettings settings = openProject.getSettings(); - - int index = currentPageShowing * settings.getRows() * settings.getColumns(); - for (int i = 0; i < settings.getRows() * settings.getColumns(); i++) { - if (padViews.size() > i) { - IPadViewV2 view = padViews.get(i); - Pad pad = openProject.getPad(index); - - view.getViewController().setupPad(pad); - } - index++; - } - } - - /** - * Entfernt alle Pads auf den Views. - */ - private void removePadsFromView() { - // Clean old pads - for (IPadViewV2 padView : padViews) { - padView.getViewController().removePad(); - } - } - - @Override - public boolean showPage(int page) { - if (openProject == null) { - return false; - } - ProjectSettings projectSettings = openProject.getSettings(); - - if (page < 0 || page >= projectSettings.getPageCount()) { - return false; - } - - // Clean - removePadsFromView(); - this.currentPageShowing = page; - addPadsToView(); - - if (menuToolbarViewController != null) { - menuToolbarViewController.highlightPageButton(page); - } - return true; - } - - @Override - public int getPage() { - return currentPageShowing; - } - - @Override - public void setGlobalVolume(double volume) { - if (openProject != null) { - for (Pad pad : openProject.getPads().values()) { - if (pad != null) - pad.setMasterVolume(volume); - } - } - } - - // Settings - @Override - public void reloadSettings(Profile old, Profile currentProfile) { - createPadViews(); - - final DoubleProperty volumeFaderValueProperty = menuToolbarViewController.getVolumeSlider().valueProperty(); - - if (old != null) { - // Unbind Volume Slider - volumeFaderValueProperty.unbindBidirectional(old.getProfileSettings().volumeProperty()); - volumeFaderValueProperty.removeListener(volumeChangeListener); - - // Clear Feedback on Devie (LaunchPad Light off) - old.getMappings().getActiveMapping().getActions().forEach(action -> action.clearFeedback()); - - // LockedListener - old.getProfileSettings().lockedProperty().removeListener(lockedListener); - } - - // Volume - volumeFaderValueProperty.bindBidirectional(currentProfile.getProfileSettings().volumeProperty()); - volumeFaderValueProperty.addListener(volumeChangeListener); - - final ProfileSettings profileSettings = currentProfile.getProfileSettings(); - final Mapping activeMapping = currentProfile.getMappings().getActiveMapping(); - - // LockedListener - profileSettings.lockedProperty().addListener(lockedListener); - - // MIDI - if (profileSettings.isMidiActive() && profileSettings.getMidiDevice() != null) { - // Load known MIDI Device - Worker.runLater(() -> - { - loadMidiDevice(profileSettings.getMidiDevice()); - Profile.currentProfile().getMappings().getActiveMapping().adjustPadColorToMapper(openProject); - - Platform.runLater(() -> - { - // Handle Mapper - if (Profile.currentProfile() != null) { - activeMapping.initFeedback(); - activeMapping.showFeedback(openProject); - } - }); - }); - } - - try { - DefaultRegistry<MainLayoutConnect> registry = PlayPadPlugin.getRegistryCollection().getMainLayouts(); - MainLayoutConnect connect = registry.getComponent(currentProfile.getProfileSettings().getMainLayoutType()); - setMainLayout(connect); - } catch (NoSuchComponentException e) { - // TODO Error Handling - e.printStackTrace(); - } - - loadUserCss(); - if (old != null && currentProfile != null) { - showPage(currentPageShowing); - } - } - - @Override - public void loadKeybinding(KeyCollection keys) { - if (menuToolbarViewController != null) { - menuToolbarViewController.loadKeybinding(keys); - } - } - - @Override - public void setGridColor(Color color) { - this.gridColor = color; - try { - Field field = padGridPane.getClass().getDeclaredField("gridLines"); - field.setAccessible(true); - Group group = (Group) field.get(padGridPane); - if (group != null) { - for (Node node : group.getChildren()) { - if (node instanceof Line) { - ((Line) node).setStroke(gridColor); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - // Notification - @Override - public void notify(String text, long duration) { - if (Platform.isFxApplicationThread()) { - notificationPane.showAndHide(text, duration); - } else { - Platform.runLater(() -> notificationPane.showAndHide(text, duration)); - } - } - - @Override - public void notify(String text, long duration, Runnable finish) { - if (Platform.isFxApplicationThread()) { - notificationPane.showAndHide(text, duration, finish); - } else { - Platform.runLater(() -> notificationPane.showAndHide(text, duration, finish)); - } - } - - @Override - public void showError(String message) { - if (Platform.isFxApplicationThread()) { - notificationPane.showError(message); - } else { - Platform.runLater(() -> notificationPane.showError(message)); - } - } - - @Override - public void hide() { - if (Platform.isFxApplicationThread()) { - notificationPane.hide(); - } else { - Platform.runLater(() -> notificationPane.hide()); - } - } - - // Utils - @Override - public void registerKeyboardListener(EventType<KeyEvent> eventType, EventHandler<KeyEvent> listener) { - getParent().getScene().addEventHandler(eventType, listener); - } - - @Override - public void loadUserCss() { - Scene scene = getStage().getScene(); - - // Clear Old - scene.getStylesheets().clear(); - - // Layout Spezifisches CSS (Base) - if (mainLayout.getStylesheet() != null) { - scene.getStylesheets().add(mainLayout.getStylesheet()); - } - - // design spezific css - if (openProject != null) { - Profile.currentProfile().currentLayout().applyCssMainView(this, getStage(), openProject); - } - - Profile.currentProfile().getMappings().getActiveMapping().adjustPadColorToMapper(openProject); - } - - /** - * Init MIDI Device by using the Midi Class and show some feedback the user. - * - * @param name - * Device Name - * - * @see Midi#lookupMidiDevice(String) - */ - private void loadMidiDevice(String name) { - try { - midi.lookupMidiDevice(name); - notificationPane.showAndHide(Localization.getString(Strings.Info_Midi_Device_Connected, name), PlayPadMain.displayTimeMillis); - } catch (NullPointerException e) { - e.printStackTrace(); - showError(Localization.getString(Strings.Error_Midi_Device_Unavailible, name)); - } catch (IllegalArgumentException | MidiUnavailableException e) { - showError(Localization.getString(Strings.Error_Midi_Device_Busy, e.getLocalizedMessage())); - e.printStackTrace(); - } - } - - public void updateWindowTitle() { - if (openProject != null && Profile.currentProfile() != null) { - getStage().setTitle(Localization.getString(Strings.UI_Window_Main_Title, openProject.getRef().getName(), - Profile.currentProfile().getRef().getName())); - } else { - getStage().setTitle(Localization.getString(Strings.UI_Window_Main_Title)); - } - } - - @Override - public List<IPadViewV2> getPadViews() { - return padViews; - } - - @Override - public MidiListener getMidiHandler() { - return midiHandler; - } - - @Override - public MenuToolbarViewController getMenuToolbarController() { - return menuToolbarViewController; - } - - @Override - public void performLayoutDependendAction(MainLayoutHandler runnable) { - runnable.handle(null, menuToolbarViewController); - layoutActions.add(runnable); - } - - @Override - public NotificationPane getNotificationPane() { - return notificationPane; - } -} diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java b/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java index 5d62dd01256dc58091e4e51f256cfd977282e2e1..abbbf607050a5f6e31bef72c3a5fabdffb387c21 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java @@ -11,7 +11,7 @@ import de.tobias.playpad.pad.PadContentRegistry; import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.pad.conntent.PadContentConnect; import de.tobias.playpad.pad.drag.PadDragMode; -import de.tobias.playpad.pad.view.IPadViewV2; +import de.tobias.playpad.pad.view.IPadView; import de.tobias.playpad.project.Project; import de.tobias.playpad.registry.NoSuchComponentException; import de.tobias.playpad.settings.GlobalSettings; @@ -41,7 +41,7 @@ public class PadDragListener { private PadDragOptionView padHud; private FileDragOptionView fileHud; - public PadDragListener(Pad pad, IPadViewV2 view) { + public PadDragListener(Pad pad, IPadView view) { this.sourcePad = pad; this.view = view.getRootNode(); @@ -143,7 +143,7 @@ public class PadDragListener { this.sourcePad.setName(FileUtils.getFilenameWithoutExtention(file.toPath().getFileName())); if (sourcePad.getController() != null) { - IPadViewV2 padView = sourcePad.getController().getView(); + IPadView padView = sourcePad.getController().getView(); padView.setContentView(sourcePad); padView.addDefaultElement(sourcePad); } diff --git a/PlayWallCore/src/de/tobias/playpad/design/CartDesign.java b/PlayWallCore/src/de/tobias/playpad/design/CartDesign.java index 0e9027f1986d948e18707d25d41882387ee27393..12d6f3a81c062d1bfc85fa226e8800cd59306396 100644 --- a/PlayWallCore/src/de/tobias/playpad/design/CartDesign.java +++ b/PlayWallCore/src/de/tobias/playpad/design/CartDesign.java @@ -2,7 +2,7 @@ package de.tobias.playpad.design; import org.dom4j.Element; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.settings.Warning; public interface CartDesign { @@ -22,9 +22,9 @@ public interface CartDesign { /* * Wird in einem neuen Thread aufgerufen */ - public abstract void handleWarning(IPadViewControllerV2 controller, Warning warning, GlobalDesign animate); + public abstract void handleWarning(IPadViewController controller, Warning warning, GlobalDesign animate); - public default void stopWarning(IPadViewControllerV2 controller) {} + public default void stopWarning(IPadViewController controller) {} public void reset(); diff --git a/PlayWallCore/src/de/tobias/playpad/design/GlobalDesign.java b/PlayWallCore/src/de/tobias/playpad/design/GlobalDesign.java index 8936f501e0897706b5e7cb40e41dbc323c4f5b8e..de0fe92c4eed206e06e9191ff8feb511f58a134e 100644 --- a/PlayWallCore/src/de/tobias/playpad/design/GlobalDesign.java +++ b/PlayWallCore/src/de/tobias/playpad/design/GlobalDesign.java @@ -15,7 +15,7 @@ import org.dom4j.io.SAXReader; import org.dom4j.io.XMLWriter; import de.tobias.playpad.PlayPadPlugin; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.project.Project; import de.tobias.playpad.registry.DefaultRegistry; import de.tobias.playpad.registry.NoSuchComponentException; @@ -50,9 +50,9 @@ public interface GlobalDesign { /* * Wird in einem neuen Thread aufgerufen */ - public void handleWarning(IPadViewControllerV2 controller, Warning warning); + public void handleWarning(IPadViewController controller, Warning warning); - public default void stopWarning(IPadViewControllerV2 controller) {} + public default void stopWarning(IPadViewController controller) {} public void reset(); diff --git a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java index 06cb57b8ae656c046100a24aced0b592c3315dd5..33993d3376e81ec3c9febde2ab568e1732b7496f 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java @@ -7,7 +7,7 @@ import de.tobias.playpad.pad.conntent.play.Pauseable; import de.tobias.playpad.pad.listener.trigger.PadTriggerContentListener; import de.tobias.playpad.pad.listener.trigger.PadTriggerDurationListener; import de.tobias.playpad.pad.listener.trigger.PadTriggerStatusListener; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.project.Project; import de.tobias.playpad.registry.NoSuchComponentException; import javafx.beans.property.DoubleProperty; @@ -47,7 +47,7 @@ public class Pad { // Utils private transient boolean eof; - private transient IPadViewControllerV2 controller; + private transient IPadViewController controller; private transient Project project; public Pad(Project project) { @@ -223,11 +223,11 @@ public class Pad { return controller != null; } - public IPadViewControllerV2 getController() { + public IPadViewController getController() { return controller; } - public void setController(IPadViewControllerV2 controller) { + public void setController(IPadViewController controller) { this.controller = controller; } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/view/IPadViewV2.java b/PlayWallCore/src/de/tobias/playpad/pad/view/IPadView.java similarity index 94% rename from PlayWallCore/src/de/tobias/playpad/pad/view/IPadViewV2.java rename to PlayWallCore/src/de/tobias/playpad/pad/view/IPadView.java index db3369ebf25d267a6899d7374e3d0247227c5acf..67c3ce99cb1b6a3956df92cea0d6a50783f68d39 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/view/IPadViewV2.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/view/IPadView.java @@ -1,7 +1,7 @@ package de.tobias.playpad.pad.view; import de.tobias.playpad.pad.Pad; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import javafx.css.PseudoClass; import javafx.scene.layout.Pane; @@ -13,7 +13,7 @@ import javafx.scene.layout.Pane; * @since 5.1.0 * */ -public interface IPadViewV2 { +public interface IPadView { /** * Gibt die aktuelle Vorschau für den Content eines Pads zurück. @@ -35,7 +35,7 @@ public interface IPadViewV2 { * * @return ViewController des Pad */ - public IPadViewControllerV2 getViewController(); + public IPadViewController getViewController(); /** * Gibt das oberste GUI Element zurück, welche im MainView verwendet wird. diff --git a/PlayWallCore/src/de/tobias/playpad/pad/view/IPadViewController.java b/PlayWallCore/src/de/tobias/playpad/pad/view/IPadViewController.java deleted file mode 100644 index 67eff6bce7fdbb36b3bff26af2509227c5d72958..0000000000000000000000000000000000000000 --- a/PlayWallCore/src/de/tobias/playpad/pad/view/IPadViewController.java +++ /dev/null @@ -1,20 +0,0 @@ -package de.tobias.playpad.pad.view; - -import de.tobias.playpad.pad.Pad; -import de.tobias.playpad.viewcontroller.IPadView; - -@Deprecated -public interface IPadViewController { - - public IPadView getParent(); - - public Pad getPad(); - - public void setPad(Pad pad); - - public void connectPad(); - - public void unconnectPad(); - - public void showDnDLayout(boolean b); -} diff --git a/PlayWallCore/src/de/tobias/playpad/pad/viewcontroller/IPadViewControllerV2.java b/PlayWallCore/src/de/tobias/playpad/pad/viewcontroller/IPadViewController.java similarity index 89% rename from PlayWallCore/src/de/tobias/playpad/pad/viewcontroller/IPadViewControllerV2.java rename to PlayWallCore/src/de/tobias/playpad/pad/viewcontroller/IPadViewController.java index ff96e4628045cba6fb7d324f88b29bc46b45168b..563272c8cec50647a64cb38fb109744f09395687 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/viewcontroller/IPadViewControllerV2.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/viewcontroller/IPadViewController.java @@ -2,7 +2,7 @@ package de.tobias.playpad.pad.viewcontroller; import de.tobias.playpad.pad.Pad; import de.tobias.playpad.pad.listener.IPadPositionListener; -import de.tobias.playpad.pad.view.IPadViewV2; +import de.tobias.playpad.pad.view.IPadView; import javafx.beans.value.ChangeListener; import javafx.util.Duration; @@ -13,7 +13,7 @@ import javafx.util.Duration; * * @since 5.1.0 */ -public interface IPadViewControllerV2 { +public interface IPadViewController { /** * Gibt das Pad zurück, welches er verwaltet. (Das Datenmodel) @@ -27,7 +27,7 @@ public interface IPadViewControllerV2 { * * @return View */ - public IPadViewV2 getView(); + public IPadView getView(); /** * Setzt ein Pad für ein View. Hier werden die Datein mittels ViewController der View bekannt gemacht. diff --git a/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java b/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java index 8ac7b1e24d1457d6a9ae2cc82176e3bc01bd21dd..3caa9fa0d669543ae5b71f6e3b9734c14f5a2233 100644 --- a/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java +++ b/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java @@ -53,6 +53,9 @@ public class GlobalSettings { // Paths @Storable private Path cachePath = ApplicationUtils.getApplication().getPath(PathType.CACHE); + // Dialogs + @Storable private boolean ignoreSaveDialog = false; + public GlobalSettings() { } @@ -97,6 +100,10 @@ public class GlobalSettings { return cachePath; } + public boolean isIgnoreSaveDialog() { + return ignoreSaveDialog; + } + // Setter public void setAutoUpdate(boolean autoUpdate) { this.autoUpdate = autoUpdate; @@ -134,6 +141,10 @@ public class GlobalSettings { this.cachePath = cachePath; } + public void setIgnoreSaveDialog(boolean ignoreSaveDialog) { + this.ignoreSaveDialog = ignoreSaveDialog; + } + // Save & Load Data private static final String KEYS_ELEMENT = "Keys"; @@ -146,6 +157,7 @@ public class GlobalSettings { private static final String LIVE_MODE_FILE_ATTR = "file"; private static final String LIVE_MODE_SETTINGS_ATTR = "settings"; private static final String CACHE_PATH_ELEMENT = "Cache-Path"; + private static final String IGNORE_SAVE_DIALOG_ELEMENT = "IgnoreSaveDialog"; /** * Lädt eine neue Instanz der Globalen Einstellungen. @@ -200,6 +212,11 @@ public class GlobalSettings { if (root.element(CACHE_PATH_ELEMENT) != null) { settings.setCachePath(Paths.get(root.element(CACHE_PATH_ELEMENT).getStringValue())); } + + // Dialogs + if (root.element(IGNORE_SAVE_DIALOG_ELEMENT) != null) { + settings.setIgnoreSaveDialog(Boolean.valueOf(root.element(IGNORE_SAVE_DIALOG_ELEMENT).getStringValue())); + } } return settings; } @@ -236,6 +253,9 @@ public class GlobalSettings { // Paths root.addElement(CACHE_PATH_ELEMENT).addText(cachePath.toString()); + // Dialogs + root.addElement(IGNORE_SAVE_DIALOG_ELEMENT).addText(String.valueOf(ignoreSaveDialog)); + XMLWriter writer = new XMLWriter(Files.newOutputStream(savePath), OutputFormat.createPrettyPrint()); writer.write(document); writer.close(); diff --git a/PlayWallCore/src/de/tobias/playpad/view/main/MainLayoutConnect.java b/PlayWallCore/src/de/tobias/playpad/view/main/MainLayoutConnect.java index 2bec2f288326cc45f96bf0d22adfe5ea80a08fbd..b8a88aa78514af5227bfe7290a8ff84d780ff548 100644 --- a/PlayWallCore/src/de/tobias/playpad/view/main/MainLayoutConnect.java +++ b/PlayWallCore/src/de/tobias/playpad/view/main/MainLayoutConnect.java @@ -1,7 +1,7 @@ package de.tobias.playpad.view.main; -import de.tobias.playpad.pad.view.IPadViewV2; -import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2; +import de.tobias.playpad.pad.view.IPadView; +import de.tobias.playpad.pad.viewcontroller.IPadViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.playpad.viewcontroller.main.MenuToolbarViewController; @@ -43,10 +43,10 @@ public interface MainLayoutConnect { * * @return Pad * - * @see IPadViewV2 notwendige Methoden für ein Pad - * @see IPadViewControllerV2 ViewController zum Pad + * @see IPadView notwendige Methoden für ein Pad + * @see IPadViewController ViewController zum Pad */ - public IPadViewV2 createPadView(); + public IPadView createPadView(); /** * Recycelt eine PadView, damit nicht immer neue erstellt werden müssen. @@ -54,7 +54,7 @@ public interface MainLayoutConnect { * @param padView * alte PadView */ - public void recyclePadView(IPadViewV2 padView); + public void recyclePadView(IPadView padView); /** * Gibt das Layout sepzifische Stylesheet zurück. diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/IPadView.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/IPadView.java deleted file mode 100644 index d134ca726741335447dce2763dce9b1d0b3ce3ea..0000000000000000000000000000000000000000 --- a/PlayWallCore/src/de/tobias/playpad/viewcontroller/IPadView.java +++ /dev/null @@ -1,44 +0,0 @@ -package de.tobias.playpad.viewcontroller; - -import de.tobias.playpad.pad.Pad; -import de.tobias.playpad.pad.view.IPadContentView; -import javafx.css.PseudoClass; -import javafx.scene.Node; -import javafx.scene.Parent; -import javafx.scene.control.Button; -import javafx.scene.control.ProgressBar; - -@Deprecated -public interface IPadView { - - public void setBusy(boolean busy); - - public void pseudoClassState(PseudoClass pseudoClass, boolean active); - - public void setStyle(String string); - - public Node getNewButton(); - - public Button getPlayButton(); - - public Button getPauseButton(); - - public Button getStopButton(); - - public ProgressBar getPlayBar(); - - public Parent getParent(); - - public void showPlaybar(boolean b); - - public void setPreviewContent(Pad pad); - - public void addDefaultButton(Pad pad); - - public void setErrorLabelActive(boolean b); - - public void setTriggerLabelActive(boolean b); - - public IPadContentView getPadContentView(); - -} diff --git a/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/IMainViewController.java b/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/IMainViewController.java index 0e5e1519ef9a4ab74281b74949b96b08c09d9b23..4a6bb28d49299a18a4dac4725e04e72fe68ddf06 100644 --- a/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/IMainViewController.java +++ b/PlayWallCore/src/de/tobias/playpad/viewcontroller/main/IMainViewController.java @@ -3,7 +3,7 @@ package de.tobias.playpad.viewcontroller.main; import java.util.List; import de.tobias.playpad.midi.MidiListener; -import de.tobias.playpad.pad.view.IPadViewV2; +import de.tobias.playpad.pad.view.IPadView; import de.tobias.playpad.settings.keys.KeyCollection; import de.tobias.playpad.view.main.MainLayoutConnect; import de.tobias.playpad.view.main.MainLayoutHandler; @@ -109,7 +109,7 @@ public interface IMainViewController extends NotificationHandler { * * @return Liste der PadViews */ - List<IPadViewV2> getPadViews(); + List<IPadView> getPadViews(); /** * Gibt den MIDI Handler des Hauptfensters für die Kacheln zurück.