diff --git a/src/main/java/com/goxr3plus/xr3player/application/windows/XPlayerWindow.java b/src/main/java/com/goxr3plus/xr3player/application/windows/XPlayerWindow.java index 6fbf1ac1..58ab6213 100644 --- a/src/main/java/com/goxr3plus/xr3player/application/windows/XPlayerWindow.java +++ b/src/main/java/com/goxr3plus/xr3player/application/windows/XPlayerWindow.java @@ -7,12 +7,19 @@ import java.util.logging.Level; import java.util.logging.Logger; +import org.kordamp.ikonli.javafx.StackedFontIcon; + +import com.jfoenix.controls.JFXButton; + import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; +import javafx.scene.control.Label; import javafx.scene.input.KeyCombination; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; +import javafx.stage.StageStyle; +import main.java.com.goxr3plus.fxborderlessscene.borderless.BorderlessScene; import main.java.com.goxr3plus.xr3player.application.tools.general.InfoTool; import main.java.com.goxr3plus.xr3player.xplayer.presenter.XPlayerController; @@ -24,11 +31,30 @@ public class XPlayerWindow extends BorderPane { // ----------------------------------------------------------------------------- + @FXML + private BorderPane topBar; + + @FXML + private Label topLabel; + + @FXML + private JFXButton maxOrNormalize; + + @FXML + private StackedFontIcon sizeStackedFontIcon; + + @FXML + private JFXButton closeWindow; + + // ----------------------------------------------------------------------------- + /** * The Window */ private Stage window; + private BorderlessScene borderlessScene; + /** * The XPlayer that the window is holding :) */ @@ -69,17 +95,20 @@ public XPlayerWindow(XPlayerController xPlayerController) { @FXML private void initialize() { - // BorderlessScene scene = new BorderlessScene(window, StageStyle.TRANSPARENT, this, 150, 150) - // scene.setMoveControl(topBar) - // -- Scene - Scene scene = new Scene(this, InfoTool.getScreenWidth() / 3, InfoTool.getScreenHeight() / 3); - scene.getStylesheets().add(getClass().getResource(InfoTool.STYLES + InfoTool.APPLICATIONCSS).toExternalForm()); - getWindow().setScene(scene); + borderlessScene = new BorderlessScene(window, StageStyle.TRANSPARENT, this, InfoTool.getScreenWidth() / 3, InfoTool.getScreenHeight() / 3); + borderlessScene.setMoveControl(topBar); + borderlessScene.getStylesheets().add(getClass().getResource(InfoTool.STYLES + InfoTool.APPLICATIONCSS).toExternalForm()); + getWindow().setScene(borderlessScene); + + // -- Label + topLabel.setText("Player " + ( xPlayerController.getKey() + 1 )); - // -- Window - //getWindow().centerOnScreen() + // -- closeWindow + closeWindow.setOnAction(a -> close()); + // -- maxOrNormalize + maxOrNormalize.setOnAction(a -> borderlessScene.maximizeStage()); } /** diff --git a/src/main/java/com/goxr3plus/xr3player/xplayer/visualizer/presenter/VisualizerWindowController.java b/src/main/java/com/goxr3plus/xr3player/xplayer/visualizer/presenter/VisualizerWindowController.java index 0bcb682e..3464033a 100644 --- a/src/main/java/com/goxr3plus/xr3player/xplayer/visualizer/presenter/VisualizerWindowController.java +++ b/src/main/java/com/goxr3plus/xr3player/xplayer/visualizer/presenter/VisualizerWindowController.java @@ -123,7 +123,7 @@ public class VisualizerWindowController extends StackPane { // ------------------------------------ - private BorderlessScene scene; + private BorderlessScene borderlessScene; /** The window. */ private Stage window; @@ -177,10 +177,10 @@ public VisualizerWindowController(XPlayerController xPlayerController) { private void initialize() { // -- Scene - scene = new BorderlessScene(window, StageStyle.TRANSPARENT, this, 150, 150); - scene.setMoveControl(topBar); - scene.setFill(Color.rgb(0, 0, 0, transparencySlider.getValue())); - scene.getStylesheets().add(getClass().getResource(InfoTool.STYLES + InfoTool.APPLICATIONCSS).toExternalForm()); + borderlessScene = new BorderlessScene(window, StageStyle.TRANSPARENT, this, 150, 150); + borderlessScene.setMoveControl(topBar); + borderlessScene.setFill(Color.rgb(0, 0, 0, transparencySlider.getValue())); + borderlessScene.getStylesheets().add(getClass().getResource(InfoTool.STYLES + InfoTool.APPLICATIONCSS).toExternalForm()); // width listener window.widthProperty().addListener((observable , oldValue , newValue) -> { @@ -197,7 +197,7 @@ private void initialize() { addEventHandler(MouseEvent.MOUSE_MOVED, m -> restartPauseTransition()); // -- KeyListeners - scene.setOnKeyReleased(key -> { + borderlessScene.setOnKeyReleased(key -> { if (key.getCode() == KeyCode.ESCAPE) { if (!window.isFullScreen()) removeVisualizer(); @@ -208,9 +208,9 @@ private void initialize() { }); // ----------Drag && Drop Listeners - scene.setOnDragOver(dragOver -> dragOver.acceptTransferModes(TransferMode.LINK)); - scene.setOnDragDropped(xPlayerController.audioDropEvent); - window.setScene(scene); + borderlessScene.setOnDragOver(dragOver -> dragOver.acceptTransferModes(TransferMode.LINK)); + borderlessScene.setOnDragDropped(xPlayerController.audioDropEvent); + window.setScene(borderlessScene); // -------------Top Bar Elements--------------- @@ -229,11 +229,11 @@ private void initialize() { }); // ----------------------------- Minimize - maxOrNormalize.setOnAction(a -> scene.maximizeStage()); + maxOrNormalize.setOnAction(a -> borderlessScene.maximizeStage()); close.setOnAction(action -> removeVisualizer()); //stage - scene.maximizedProperty().addListener((observable , oldValue , newValue) -> { + borderlessScene.maximizedProperty().addListener((observable , oldValue , newValue) -> { if (newValue) { sizeStackedFontIcon.getChildren().get(0).setVisible(true); sizeStackedFontIcon.getChildren().get(1).setVisible(false); @@ -245,7 +245,7 @@ private void initialize() { // transparencySlider //transparencySlider.disableProperty().bind(window.showingProperty().not()); - transparencySlider.valueProperty().addListener(list -> scene.setFill(Color.rgb(0, 0, 0, transparencySlider.getValue()))); + transparencySlider.valueProperty().addListener(list -> borderlessScene.setFill(Color.rgb(0, 0, 0, transparencySlider.getValue()))); // PauseTransition pauseTransition.setOnFinished(f -> { diff --git a/src/main/resources/fxml/players/XPlayerWindow.fxml b/src/main/resources/fxml/players/XPlayerWindow.fxml index b31bfef9..401d155f 100644 --- a/src/main/resources/fxml/players/XPlayerWindow.fxml +++ b/src/main/resources/fxml/players/XPlayerWindow.fxml @@ -1,10 +1,66 @@ + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+