use of com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService in project tactview by helospark.
the class SingleFullImageViewController method renderFullScreenAtCurrentLocation.
public void renderFullScreenAtCurrentLocation() {
TimelinePosition currentPosition = uiTimelineManager.getCurrentPosition();
int height = projectRepository.getHeight();
int width = projectRepository.getWidth();
TimelineManagerFramesRequest frameRequest = TimelineManagerFramesRequest.builder().withPosition(currentPosition).withScale(1.0).withPreviewWidth(width).withPreviewHeight(height).build();
CompletableFuture.supplyAsync(() -> {
ByteBuffer image = timelineManagerRenderService.getFrame(frameRequest).getAudioVideoFragment().getVideoResult().getBuffer();
return byteBufferToImageConverter.convertToJavafxImage(image, width, height);
}).exceptionally(e -> {
logger.error("Error rendering image", e);
return null;
}).thenAccept(image -> {
Platform.runLater(() -> {
ImageShowDialog dialog = new ImageShowDialog(image, stylesheetAdderService);
dialog.show();
});
});
}
use of com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService in project tactview by helospark.
the class JavaFXUiMain method start.
@Override
public void start(Stage stage) throws IOException {
DirtyRepository dirtyRepository = lightDi.getBean(DirtyRepository.class);
ExitWithSaveService exitWithSaveService = lightDi.getBean(ExitWithSaveService.class);
StylesheetAdderService styleSheetAdder = lightDi.getBean(StylesheetAdderService.class);
styleSheetAdder.setTactviewIconForStage(stage);
JavaFXUiMain.STAGE = stage;
lightDi.getListOfBeans(MainWindowStageAware.class).forEach(listener -> listener.setMainWindowStage(stage));
NotificationPane notificationPane = new NotificationPane();
BorderPane root = new BorderPane();
Scene scene = new Scene(root, 650, 550, Color.GREY);
styleSheetAdder.addStyleSheets(root, "stylesheet.css");
MenuBar menuBar = lightDi.getBean(MenuProcessor.class).createMenuBar();
if (SystemUtils.IS_OS_MAC_OSX) {
// https://stackoverflow.com/a/28874063
menuBar.useSystemMenuBarProperty().set(true);
}
stage.setOnCloseRequest(e -> {
exitApplication(exitWithSaveService, e);
});
root.setTop(menuBar);
stage.setScene(scene);
stage.setTitle("TactView - Video editor");
dirtyRepository.addUiChangeListener(value -> {
Platform.runLater(() -> {
String title = "";
if (value) {
title += "* ";
}
title += "TactView - Video editor";
stage.setTitle(title);
});
});
stage.setMaximized(true);
if (SystemUtils.IS_OS_MAC) {
SwingFXUtils.toFXImage(new BufferedImage(100, 100, TYPE_INT_BGR), null);
}
// spacing between child nodes only.
SplitPane mainContentPane = new SplitPane();
mainContentPane.setId("content-area");
mainContentPane.setPrefWidth(scene.getWidth());
// space between vbox border and child nodes column
mainContentPane.setPadding(new Insets(1));
mainContentPane.setDividerPositions(0.6);
canvas = new Canvas();
lightDi.getBean(CanvasStateHolder.class).setCanvas(canvas);
lightDi.getBean(DefaultCanvasTranslateSetter.class).setDefaultCanvasTranslate(uiProjectRepository.getPreviewWidth(), uiProjectRepository.getPreviewHeight());
InputModeRepository inputModeRepository = lightDi.getBean(InputModeRepository.class);
inputModeRepository.setCanvas(canvas);
displayUpdateService.setCanvas(canvas);
displayUpdateService.updateCurrentPositionWithInvalidatedCache();
Tooltip tooltip = new Tooltip();
StringProperty statusTextProperty = lightDi.getBean(VideoStatusBarUpdater.class).getTextProperty();
tooltip.textProperty().bind(statusTextProperty);
tooltip.setHideOnEscape(false);
tooltip.setAutoHide(false);
tooltip.setAnchorLocation(AnchorLocation.CONTENT_TOP_LEFT);
statusTextProperty.addListener((e, oldV, newV) -> {
if (newV.length() > 0) {
Bounds canvasBottom = canvas.localToScene(canvas.getBoundsInLocal());
double x = canvasBottom.getMinX();
double y = canvasBottom.getMaxY() + 60;
tooltip.show(canvas, x, y);
} else {
tooltip.hide();
}
});
tooltip.setWrapText(true);
HBox upperPane = new HBox();
upperPane.setId("upper-content-area");
upperPane.setMinHeight(300);
upperPane.setFillHeight(true);
DetachableTabPaneLoadModel layoutToLoad = lightDi.getBean(DefaultLayoutProvider.class).provideDefaultLayout();
DockableTabRepository dockableTabRepository = lightDi.getBean(DockableTabRepository.class);
dockableTabRepository.setParentPane(upperPane);
dockableTabRepository.loadAndSetModelToParent(layoutToLoad);
TiwulFXUtil.setTiwulFXStyleSheet(scene);
VBox lower = new VBox(5);
lower.setPrefWidth(scene.getWidth());
lower.setPrefHeight(300);
lower.setId("timeline-view");
BorderPane timeline = uiTimeline.createTimeline(lower, root);
lower.getChildren().add(timeline);
VBox.setVgrow(timeline, Priority.ALWAYS);
mainContentPane.getItems().add(upperPane);
mainContentPane.getItems().add(lower);
mainContentPane.setOrientation(Orientation.VERTICAL);
root.setCenter(mainContentPane);
notificationPane.setContent(root);
inputModeRepository.registerInputModeChangeConsumerr(onClassChangeDisableTabs());
inputModeRepository.registerInputModeChangeConsumerr(onClassChange(timeline));
lightDi.getListOfBeans(ScenePostProcessor.class).stream().forEach(processor -> processor.postProcess(scene));
lightDi.getListOfBeans(PostInitializationArgsCallback.class).forEach(postInitCallback -> postInitCallback.call(mainArgs));
if (splashStage.isShowing()) {
stage.show();
splashStage.toFront();
FadeTransition fadeSplash = new FadeTransition(Duration.seconds(0.5), splasViewh);
fadeSplash.setDelay(Duration.millis(800));
fadeSplash.setFromValue(1.0);
fadeSplash.setToValue(0.0);
fadeSplash.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
splashStage.hide();
}
});
fadeSplash.play();
}
}
use of com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService in project tactview by helospark.
the class GraphSetterChainItem method handle.
@Override
protected EffectLine handle(GraphProvider graphingProvider, ValueProviderDescriptor descriptor) {
Button button = new Button("Open graph window", new Glyph("FontAwesome", FontAwesome.Glyph.DIAMOND));
GraphingComponent graphingComponent = new GraphingComponent(250, 100, effectGraphAccessor, messagingService, menuItemFactories, commandInterpreter, stylesheetAdderService, nameToIdRepository);
graphingComponent.setGraphProvider(graphingProvider);
graphingComponent.setZoom(0.4);
graphingComponent.setParent(scene.getWindow());
graphingComponent.redrawGraphProvider();
VBox vbox = new VBox(button, graphingComponent);
PrimitiveEffectLine result = PrimitiveEffectLine.builder().withCurrentValueProvider(() -> effectParametersRepository.getValueAtAsObject(graphingProvider.getId(), uiTimelineManager.getCurrentPosition())).withVisibleNode(vbox).withDescriptorId(graphingProvider.getId()).withEffectParametersRepository(effectParametersRepository).withCommandInterpreter(commandInterpreter).withDescriptor(descriptor).withUpdateFunction(position -> {
graphingComponent.redrawGraphProvider();
}).withUpdateFromValue(value -> {
}).build();
button.setOnMouseClicked(event -> {
dockableTabRepository.openTab(graphingDialog);
graphingDialog.showProvider(graphingProvider);
});
return result;
}
Aggregations