diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties index 6c6afff4663d8077c6057df0050c7caa7e9ac731..2aded35cac3f980365898f41d49268042162c92d 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties +++ b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties @@ -283,4 +283,10 @@ UI.Dialog.Page.Name.Content=Geben Sie einen neuen Namen f Tooltip.PlayButton=Wiedergabemodus Tooltip.DragButton=Drag'n'Drop Modus Tooltip.PageButton=Seiten bearbeiten -Tooltip.ColorButton=F�rbenmodus \ No newline at end of file +Tooltip.ColorButton=F�rbenmodus + +Tooltip.Page.LeftMove=Nach links schieben +Tooltip.Page.RightMove=Nach rechts schieben +Tooltip.Page.Rename=Umbenennen +Tooltip.Page.Clone=Duplizieren +Tooltip.Page.Delete=L�schen \ No newline at end of file diff --git a/PlayWall/src/de/tobias/playpad/Strings.java b/PlayWall/src/de/tobias/playpad/Strings.java index 4991fd7ab346d117b0be81470a9aa600a914c1f1..7a24acf3963219898bdddc974049ce50e19f0853 100644 --- a/PlayWall/src/de/tobias/playpad/Strings.java +++ b/PlayWall/src/de/tobias/playpad/Strings.java @@ -267,4 +267,10 @@ public class Strings { public static final String Tooltip_DragButton = "Tooltip.DragButton"; public static final String Tooltip_PageButton = "Tooltip.PageButton"; public static final String Tooltip_ColorButton = "Tooltip.ColorButton"; + + public static final String Tooltip_Page_LeftMove = "Tooltip.Page.LeftMove"; + public static final String Tooltip_Page_RightMove = "Tooltip.Page.RightMove"; + public static final String Tooltip_Page_Rename = "Tooltip.Page.Rename"; + public static final String Tooltip_Page_Clone = "Tooltip.Page.Clone"; + public static final String Tooltip_Page_Delete = "Tooltip.Page.Delete"; } diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPageEditButtonView.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPageEditButtonView.java index 12b67b858cb9578d68d6c80012f985f496889433..3a161e2deac46215f00d77108cb223774be0b570 100644 --- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPageEditButtonView.java +++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPageEditButtonView.java @@ -19,6 +19,7 @@ import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.TextInputDialog; +import javafx.scene.control.Tooltip; import javafx.scene.layout.HBox; import javafx.stage.Modality; import javafx.stage.Stage; @@ -29,6 +30,7 @@ public class DesktopPageEditButtonView extends HBox implements EventHandler<Acti private Button leftMoveButton; private Button rightMoveButton; private Button editTextButton; + private Button cloneButton; private Button deleteButton; private transient Button pageButton; @@ -41,21 +43,30 @@ public class DesktopPageEditButtonView extends HBox implements EventHandler<Acti leftMoveButton = new Button("", new FontIcon(FontAwesomeType.ARROW_LEFT)); leftMoveButton.setOnAction(this); + leftMoveButton.setTooltip(new Tooltip(Localization.getString(Strings.Tooltip_Page_LeftMove))); leftMoveButton.setFocusTraversable(false); rightMoveButton = new Button("", new FontIcon(FontAwesomeType.ARROW_RIGHT)); rightMoveButton.setOnAction(this); + rightMoveButton.setTooltip(new Tooltip(Localization.getString(Strings.Tooltip_Page_RightMove))); rightMoveButton.setFocusTraversable(false); editTextButton = new Button("", new FontIcon(FontAwesomeType.EDIT)); editTextButton.setOnAction(this); + editTextButton.setTooltip(new Tooltip(Localization.getString(Strings.Tooltip_Page_Rename))); editTextButton.setFocusTraversable(false); + cloneButton = new Button("", new FontIcon(FontAwesomeType.COPY)); + cloneButton.setOnAction(this); + cloneButton.setTooltip(new Tooltip(Localization.getString(Strings.Tooltip_Page_Clone))); + cloneButton.setFocusTraversable(false); + deleteButton = new Button("", new FontIcon(FontAwesomeType.TRASH)); deleteButton.setOnAction(this); + deleteButton.setTooltip(new Tooltip(Localization.getString(Strings.Tooltip_Page_Delete))); deleteButton.setFocusTraversable(false); - getChildren().addAll(leftMoveButton, rightMoveButton, editTextButton, deleteButton); + getChildren().addAll(leftMoveButton, rightMoveButton, editTextButton, cloneButton, deleteButton); setSpacing(7); } @@ -119,6 +130,19 @@ public class DesktopPageEditButtonView extends HBox implements EventHandler<Acti pageButton.setText(name); event.consume(); + } else if (event.getSource() == cloneButton) { + try { + Page clone = page.clone(); + Project project = page.getProjectReference(); + project.addPage(clone); + + controller.initPageButtons(); + controller.highlightPageButton(page.getId()); + event.consume(); + } catch (CloneNotSupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } else if (event.getSource() == deleteButton) { Alert alert = new Alert(AlertType.CONFIRMATION); @@ -134,8 +158,10 @@ public class DesktopPageEditButtonView extends HBox implements EventHandler<Acti { Project project = page.getProjectReference(); project.removePage(page); + PlayPadMain.getProgramInstance().getMainViewController().showPage(0); controller.initPageButtons(); controller.highlightPageButton(0); // Show first page + event.consume(); }); } } diff --git a/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java b/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java index 5a0dc867328d956868ea95a2ed51b2dd0c5664a0..c2d7d5ca85badc152a301c5c113cf4a1b8268f69 100644 --- a/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java +++ b/PlayWall/src/de/tobias/playpad/pad/content/AudioContent.java @@ -51,10 +51,8 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, public AudioContent(Pad pad) { super(pad); - volumeListener = (a, b, c) -> - { - updateVolume(); - }; + // Pad Volume Listener + volumeListener = (a, b, c) -> updateVolume(); } @Override @@ -262,6 +260,13 @@ public class AudioContent extends PadContent implements Pauseable, Durationable, public PadContent clone() throws CloneNotSupportedException { AudioContent clone = (AudioContent) super.clone(); clone.path = Paths.get(path.toUri()); + + AudioRegistry audioRegistry = PlayPadPlugin.getRegistryCollection().getAudioHandlers(); + clone.audioHandler = audioRegistry.getCurrentAudioHandler().createAudioHandler(this); + + clone.durationProperty = new SimpleObjectProperty<>(); + clone.positionProperty = new SimpleObjectProperty<>(); + clone.loadMedia(); return clone; } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java index 4a3ea2f3d6b6c07adeee17a67f966310450ca513..989dccaac2d9802ce8cc670393712ab494498759 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/Pad.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/Pad.java @@ -304,16 +304,23 @@ public class Pad implements Cloneable { Pad clone = (Pad) super.clone(); clone.uuid = UUID.randomUUID(); - clone.indexProperty = new SimpleIntegerProperty(); - clone.pageProperty = new SimpleIntegerProperty(); + clone.indexProperty = new SimpleIntegerProperty(getIndex()); + clone.pageProperty = new SimpleIntegerProperty(getPage()); clone.nameProperty = new SimpleStringProperty(getName()); clone.statusProperty = new SimpleObjectProperty<PadStatus>(getStatus()); - clone.contentProperty = new SimpleObjectProperty<PadContent>(getContent().clone()); - clone.getContent().setPad(clone); - + if (getContent() != null) { + clone.contentProperty = new SimpleObjectProperty<PadContent>(getContent().clone()); + clone.getContent().setPad(clone); + } else { + clone.contentProperty = new SimpleObjectProperty<PadContent>(); + } + clone.padSettings = padSettings.clone(); + clone.controller = null; + clone.project = project; + clone.initPadListener(); return clone; } diff --git a/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java b/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java index 1aad4870ef6c72c727927877833e892bbc8abf3a..698ac80e2d438c866fde83ff1fac944372f5ba8e 100644 --- a/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java +++ b/PlayWallCore/src/de/tobias/playpad/pad/PadSettings.java @@ -227,7 +227,7 @@ public class PadSettings implements Cloneable { else settings.warningProperty = new SimpleObjectProperty<>(); - settings.customLayoutProperty = new SimpleBooleanProperty(isCustomWarning()); + settings.customLayoutProperty = new SimpleBooleanProperty(isCustomLayout()); settings.layouts = new HashMap<>(); for (String key : layouts.keySet()) { CartDesign clone = (CartDesign) layouts.get(key).clone(); diff --git a/PlayWallCore/src/de/tobias/playpad/project/Project.java b/PlayWallCore/src/de/tobias/playpad/project/Project.java index 449c23b1e5be05ea5cf7326caa94292241189a2c..6ed273ba2ef1b6ced6be424cd3ebfc3606033cad 100644 --- a/PlayWallCore/src/de/tobias/playpad/project/Project.java +++ b/PlayWallCore/src/de/tobias/playpad/project/Project.java @@ -314,11 +314,18 @@ public class Project { } public boolean addPage() { + int index = pages.size(); + return addPage(new Page(index, this)); + } + + public boolean addPage(Page page) { if (pages.size() == ProjectSettings.MAX_PAGES) { return false; } int index = pages.size(); - pages.add(new Page(index, this)); + page.setId(index); + pages.add(page); return true; + } } diff --git a/PlayWallCore/src/de/tobias/playpad/project/page/Page.java b/PlayWallCore/src/de/tobias/playpad/project/page/Page.java index d2c135bada7d4fd20334cef357ff913123322563..2ccea70164543c0d4f500d66ec2743060ffd8fd6 100644 --- a/PlayWallCore/src/de/tobias/playpad/project/page/Page.java +++ b/PlayWallCore/src/de/tobias/playpad/project/page/Page.java @@ -13,7 +13,7 @@ import de.tobias.playpad.project.ProjectSettings; * * @since 6.0.0 */ -public class Page { +public class Page implements Cloneable { private int id; private String name; @@ -43,6 +43,9 @@ public class Page { public void setId(int id) { this.id = id; + for (Pad pad : pads.values()) { + pad.setPage(id); + } } public String getName() { @@ -96,4 +99,18 @@ public class Page { public String toString() { return "Page [id=" + id + "]"; } + + @Override + public Page clone() throws CloneNotSupportedException { + Page clone = (Page) super.clone(); + clone.id = id; + clone.name = name; + clone.projectReference = projectReference; + clone.pads = new HashMap<>(); + for (int key : pads.keySet()) { + Pad padClone = pads.get(key).clone(); + clone.pads.put(key, padClone); + } + return clone; + } }