Skip to content

Commit

Permalink
Started work on VideoFilter applying
Browse files Browse the repository at this point in the history
  • Loading branch information
olir committed Mar 15, 2018
1 parent a596ace commit b0fdbaf
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import de.screenflow.frankenstein.vf.input.VideoInput;

/**
* Data class
* Handles information about the configuration of the 'Project' and the tool.
*/
public class Configuration {
// Ini-File properties
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package de.screenflow.frankenstein.fxml;

public class FilterSetupController {

}
10 changes: 9 additions & 1 deletion src/main/java/de/screenflow/frankenstein/fxml/FxMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class FxMain extends Application {
private static final double WIDTH = 1024.0;
private static final double HEIGHT = 768.0;

private Locale locale = Locale.getDefault();
private static Locale locale = Locale.getDefault();


public static void fxmain(Configuration c) {
Expand All @@ -70,6 +70,7 @@ public void start(Stage primaryStage) {
System.out.println("Warning: nu.pattern.OpenCV not found."); // eclipse
// environment
}
System.out.println("Loading from "+System.getProperty("java.library.path"));
System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);

theStage = primaryStage;
Expand Down Expand Up @@ -165,4 +166,11 @@ public void setDocumentInTitle(String name) {
else
theStage.setTitle(APP_NAME);
}



public static Locale getLocale() {
return locale;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@

import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.IOException;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import org.opencv.core.CvException;
import org.opencv.core.Mat;
Expand All @@ -28,6 +33,7 @@
import de.screenflow.frankenstein.Configuration;
import de.screenflow.frankenstein.MovieProcessor;
import de.screenflow.frankenstein.ProcessingListener;
import de.screenflow.frankenstein.vf.VideoFilter;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
Expand All @@ -36,6 +42,9 @@
import javafx.embed.swing.SwingFXUtils;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
Expand All @@ -48,6 +57,8 @@
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Popup;
import javafx.stage.Stage;

public class ProcessingSceneController implements ProcessingListener {
Expand Down Expand Up @@ -113,11 +124,11 @@ public class ProcessingSceneController implements ProcessingListener {
@FXML
Button btnMark;

@FXML
Button btnCopy;

@FXML
Button btnPaste;
// @FXML
// Button btnCopy;
//
// @FXML
// Button btnPaste;

@FXML
ToggleButton btnOneFrame;
Expand Down Expand Up @@ -203,8 +214,8 @@ public void changed(ObservableValue<? extends FilterElement> observable, FilterE
btnMark.setDisable(true);
btnOneFrame.setDisable(true);
btnClear.setDisable(true);
btnCopy.setDisable(true);
btnPaste.setDisable(true);
// btnCopy.setDisable(true);
// btnPaste.setDisable(true);
btnListAdd.setDisable(true);
btnListFilter.setDisable(true);
btnListDelete.setDisable(true);
Expand Down Expand Up @@ -391,8 +402,8 @@ public void initProcessing(ConfigurationSceneController cController, Configurati
btnMark.setDisable(false);
btnOneFrame.setDisable(true);
btnClear.setDisable(true);
btnCopy.setDisable(true);
btnPaste.setDisable(true);
// btnCopy.setDisable(true);
// btnPaste.setDisable(true);
btnListAdd.setDisable(true);
btnListFilter.setDisable(true);
btnListDelete.setDisable(true);
Expand Down Expand Up @@ -514,8 +525,8 @@ public void taskError(String errorMessage) {
drawEditCanvas();
btnMark.setDisable(true);
btnClear.setDisable(true);
btnCopy.setDisable(true);
btnPaste.setDisable(true);
// btnCopy.setDisable(true);
// btnPaste.setDisable(true);
btnListAdd.setDisable(true);
btnListFilter.setDisable(true);
btnListDelete.setDisable(true);
Expand Down Expand Up @@ -631,7 +642,7 @@ public void createMark() {
btnMark.setDisable(false);
btnOneFrame.setDisable(false);
btnClear.setDisable(false);
btnCopy.setDisable(false);
// btnCopy.setDisable(false);
btnListAdd.setDisable(false);
drawEditCanvas();
updateDuration();
Expand All @@ -647,33 +658,33 @@ public void clearMark() {
btnMark.setDisable(false);
btnOneFrame.setDisable(true);
btnClear.setDisable(true);
btnCopy.setDisable(true);
btnPaste.setDisable(true);
// btnCopy.setDisable(true);
// btnPaste.setDisable(true);
btnListAdd.setDisable(true);
drawEditCanvas();
updateDuration();
});
}

@FXML
public void copy() {
clipBoardRange = currentRange();
markPosition = -1;
btnClear.setDisable(true);
btnMark.setDisable(false);
btnCopy.setDisable(true);
btnPaste.setDisable(false);
btnListAdd.setDisable(true);
Platform.runLater(() -> {
drawEditCanvas();
updateDuration();
});
}

@FXML
public void paste() {
System.err.println("paste");
}
// @FXML
// public void copy() {
// clipBoardRange = currentRange();
// markPosition = -1;
// btnClear.setDisable(true);
// btnMark.setDisable(false);
// btnCopy.setDisable(true);
// btnPaste.setDisable(false);
// btnListAdd.setDisable(true);
// Platform.runLater(() -> {
// drawEditCanvas();
// updateDuration();
// });
// }
//
// @FXML
// public void paste() {
// System.err.println("paste");
// }

@FXML
public void oneFrameChanged() {
Expand Down Expand Up @@ -731,11 +742,26 @@ private void updateDuration() {
public void filterAdd() {
FilterElement val = new FilterElement(currentRange());
filterListData.add(val);
clearMark();
// clearMark();
}

@FXML
public void filterSetup() {

FilterSetupController controller = new FilterSetupController();
PropertyResourceBundle bundleConfiguration = (PropertyResourceBundle) ResourceBundle
.getBundle("de/screenflow/frankenstein/bundles/filtersetup", FxMain.getLocale());
FXMLLoader loader = new FXMLLoader(getClass().getResource("FilterSetupPopup.fxml"), bundleConfiguration);
Stage stage = new Stage();
try {
stage.setScene(new Scene(loader.load()));
stage.setTitle("Edit filter "+selectedFilter.toStringRange());
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(btnListFilter.getScene().getWindow());
stage.showAndWait();
} catch (IOException e) {
e.printStackTrace();
}
}

@FXML
Expand All @@ -746,13 +772,18 @@ public void filterDelete() {

class FilterElement {
Range r;

VideoFilter filter = null;

FilterElement(Range r) {
FilterElement.this.r = r;
}

public String toString() {
return r.toString();
return toStringRange()+" "+(filter!=null?filter:"<none>");
}

public String toStringRange() {
return "" + time((r.start - 1.0) / fps) + "-" + time((r.end - 1.0) / fps) + " " + r.toString();
}
}

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.BorderPane?>

<BorderPane maxHeight="600.0" maxWidth="512.0" prefHeight="600.0" prefWidth="512.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.screenflow.frankenstein.fxml.FilterSetupController">
</BorderPane>
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,6 @@
<Insets bottom="-2.0" top="-2.0" />
</padding>
</TextField>
<Label fx:id="l_durationTitle" text="Duration" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.valignment="BOTTOM" GridPane.vgrow="NEVER">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="l_durationTime" alignment="CENTER_RIGHT" contentDisplay="RIGHT" text="00:00:00.00" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="NEVER">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="l_durationFrames" alignment="CENTER_RIGHT" contentDisplay="RIGHT" nodeOrientation="LEFT_TO_RIGHT" text="0" textAlignment="RIGHT" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="NEVER">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
<padding>
<Insets left="8.0" right="8.0" />
Expand All @@ -128,18 +113,44 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<HBox fillHeight="false" spacing="4.0" GridPane.columnSpan="2">
<HBox fillHeight="false" prefHeight="51.0" prefWidth="336.0" spacing="4.0" GridPane.columnSpan="2">
<children>
<Button fx:id="btnMark" minWidth="44.0" mnemonicParsing="false" onAction="#createMark" text="M" />
<ToggleButton fx:id="btnOneFrame" minWidth="44.0" mnemonicParsing="false" onAction="#oneFrameChanged" text="1" />
<Button fx:id="btnClear" disable="true" minWidth="44.0" mnemonicParsing="false" onAction="#clearMark" text="Clr" />
<Label minWidth="32.0" />
<Button fx:id="btnCopy" disable="true" minWidth="44.0" mnemonicParsing="false" onAction="#copy" text="C" />
<Button fx:id="btnPaste" disable="true" minWidth="44.0" mnemonicParsing="false" onAction="#paste" text="P" />
<Button disable="true" minWidth="44.0" mnemonicParsing="false" text="D" />
<Label minWidth="32.0" />
</children>
</HBox>
<GridPane GridPane.halignment="LEFT" GridPane.hgrow="NEVER" GridPane.rowIndex="1" GridPane.valignment="TOP" GridPane.vgrow="NEVER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints fillHeight="false" maxHeight="16.0" minHeight="16.0" prefHeight="16.0" valignment="BOTTOM" vgrow="NEVER" />
<RowConstraints fillHeight="false" maxHeight="16.0" minHeight="16.0" prefHeight="16.0" valignment="CENTER" vgrow="NEVER" />
<RowConstraints fillHeight="false" maxHeight="16.0" minHeight="16.0" prefHeight="16.0" valignment="CENTER" vgrow="NEVER" />
</rowConstraints>
<padding>
<Insets left="8.0" right="8.0" />
</padding>
<children>
<Label fx:id="l_durationTitle" text="Duration" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.valignment="BOTTOM" GridPane.vgrow="NEVER">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="l_durationTime" alignment="CENTER_RIGHT" contentDisplay="RIGHT" text="00:00:00.00" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="NEVER">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="l_durationFrames" alignment="CENTER_RIGHT" contentDisplay="RIGHT" nodeOrientation="LEFT_TO_RIGHT" text="0" textAlignment="RIGHT" GridPane.halignment="RIGHT" GridPane.hgrow="NEVER" GridPane.rowIndex="2" GridPane.valignment="CENTER" GridPane.vgrow="NEVER">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</GridPane>
<GridPane hgap="4.0" maxHeight="-Infinity" maxWidth="-Infinity" vgap="4.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="ALWAYS" />
Expand All @@ -155,7 +166,7 @@
<Font size="14.0" />
</font>
</Button>
<Button fx:id="btnListFilter" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#filterSetup" prefHeight="28.0" prefWidth="60.0" text="Filter..." textAlignment="CENTER" GridPane.rowIndex="1">
<Button fx:id="btnListFilter" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#filterSetup" prefHeight="28.0" prefWidth="60.0" text="Edit..." textAlignment="CENTER" GridPane.rowIndex="1">
<font>
<Font size="14.0" />
</font>
Expand All @@ -165,6 +176,7 @@
<Font size="14.0" />
</font>
</Button>
<Label minWidth="32.0" />
</children>
</GridPane>
</children>
Expand All @@ -174,7 +186,7 @@
<ListView fx:id="listViewFilter" maxHeight="132.0" maxWidth="310.0" minHeight="200.0" BorderPane.alignment="TOP_LEFT" />
</center>
<top>
<Label text="Local Filter List:" BorderPane.alignment="BOTTOM_LEFT">
<Label text="Section Filters:" BorderPane.alignment="BOTTOM_LEFT">
<font>
<Font size="14.0" />
</font>
Expand Down

0 comments on commit b0fdbaf

Please sign in to comment.