Search in sources :

Example 1 with TimelineManagerAccessor

use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.

the class MoveToContextMenuChainItem method createMoveToRightMenuItem.

private MenuItem createMoveToRightMenuItem(ClipContextMenuChainItemRequest request) {
    MenuItem moveToLeftMenuItem = new MenuItem("to furthest right");
    moveToLeftMenuItem.setOnAction(e -> {
        ClipToRightCommand clipMovedCommand = ClipToRightCommand.builder().withAdditionalClipIds(request.getAllClips().stream().map(a -> a.getId()).collect(Collectors.toList())).withClipId(request.getPrimaryClip().getId()).withTimelineManager(timelineManagerAccessor).build();
        ClipToRightCommand commandResult = commandInterpreter.sendWithResult(clipMovedCommand).join();
        if (!commandResult.wasOperationSuccessful()) {
            Alert alert = alertDialogFactory.createSimpleAlertWithTitleAndContent(AlertType.ERROR, "Cannot move clip to right", "Cannot move clip to right");
            alert.showAndWait();
        }
    });
    return moveToLeftMenuItem;
}
Also used : AlertDialogFactory(com.helospark.tactview.ui.javafx.stylesheet.AlertDialogFactory) Component(com.helospark.lightdi.annotation.Component) Alert(javafx.scene.control.Alert) MenuItem(javafx.scene.control.MenuItem) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Collectors(java.util.stream.Collectors) ClipMovedCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipMovedCommand) Menu(javafx.scene.control.Menu) Order(com.helospark.lightdi.annotation.Order) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) BigDecimal(java.math.BigDecimal) AlertType(javafx.scene.control.Alert.AlertType) StylesheetAdderService(com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) ClipToLeftCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipToLeftCommand) MoveByUnitService(com.helospark.tactview.ui.javafx.commands.impl.service.MoveByUnitService) TextInputDialog(javafx.scene.control.TextInputDialog) ClipToRightCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipToRightCommand) Optional(java.util.Optional) Direction(com.helospark.tactview.ui.javafx.commands.impl.service.MoveByUnitService.Direction) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) Alert(javafx.scene.control.Alert) ClipToRightCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipToRightCommand)

Example 2 with TimelineManagerAccessor

use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.

the class TimelineManagerAccessorFactory method createAccessor.

public TimelineManagerAccessor createAccessor(TimelineChannelsState timelineState) {
    TimelineManagerAccessor result = new TimelineManagerAccessor(messagingService, clipFactoryChain, effectFactoryChain, linkClipRepository, timelineState, longProcessRequestor, projectRepository);
    result.postConstruct();
    return result;
}
Also used : TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor)

Example 3 with TimelineManagerAccessor

use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.

the class TactviewInitializationCallback method call.

@Override
public void call(String[] args) {
    boolean initialized = false;
    try {
        Optional<String> optionalFileName = Arrays.stream(args).filter(a -> !a.startsWith("-")).findFirst();
        if (optionalFileName.isPresent()) {
            File file = new File(optionalFileName.get());
            LOGGER.debug("Application launched with " + Arrays.toString(args));
            if (file.exists()) {
                if (file.getName().endsWith(".tvs")) {
                    LOGGER.info("Loading save file " + file.getAbsolutePath());
                    saveAndLoadHandler.load(new LoadRequest(file.getAbsolutePath()));
                    currentProjectSavedFileRepository.setCurrentSavedFile(file.getAbsolutePath());
                    initialized = true;
                } else {
                    LOGGER.info("Loading media file " + file.getAbsolutePath());
                    projectInitializer.clearAndInitialize();
                    String firstChannelId = timelineManagerAccessor.getChannels().get(0).getId();
                    AddClipsCommand addClipCommand = AddClipsCommand.builder().withChannelId(firstChannelId).withPosition(TimelinePosition.ofZero()).withTimelineManager(timelineManagerAccessor).withFilePaths(List.of(file.getAbsolutePath())).build();
                    commandInterpreterService.synchronousSend(addClipCommand);
                    initialized = true;
                }
            }
        }
    } catch (Exception e) {
        alertDialogFactory.createErrorAlertWithStackTrace("Initialization failed", e);
    }
    if (!initialized) {
        projectInitializer.clearAndInitialize();
    }
}
Also used : CurrentProjectSavedFileRepository(com.helospark.tactview.ui.javafx.save.CurrentProjectSavedFileRepository) AlertDialogFactory(com.helospark.tactview.ui.javafx.stylesheet.AlertDialogFactory) Component(com.helospark.lightdi.annotation.Component) Arrays(java.util.Arrays) Logger(org.slf4j.Logger) PostInitializationArgsCallback(com.helospark.tactview.core.init.PostInitializationArgsCallback) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) LoadRequest(com.helospark.tactview.core.save.LoadRequest) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) LoggerFactory(org.slf4j.LoggerFactory) SaveAndLoadHandler(com.helospark.tactview.core.save.SaveAndLoadHandler) File(java.io.File) List(java.util.List) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) Optional(java.util.Optional) AddClipsCommand(com.helospark.tactview.ui.javafx.commands.impl.AddClipsCommand) ProjectInitializer(com.helospark.tactview.ui.javafx.ProjectInitializer) LoadRequest(com.helospark.tactview.core.save.LoadRequest) File(java.io.File) AddClipsCommand(com.helospark.tactview.ui.javafx.commands.impl.AddClipsCommand)

Example 4 with TimelineManagerAccessor

use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method selectClipsUnderPlayheadMenuItem.

@Bean
@Order(1803)
public SelectableMenuContribution selectClipsUnderPlayheadMenuItem(SelectedNodeRepository selectedNodeRepository, TimelineManagerAccessor timelineManager, UiTimelineManager uiTimelineManager) {
    return new DefaultMenuContribution(List.of(EDIT_ROOT, SELECT_ROOT, "Clips under playhead"), event -> {
        TimelinePosition position = uiTimelineManager.getCurrentPosition();
        List<String> newSelectedClips = timelineManager.getAllClipIds().stream().flatMap(a -> timelineManager.findClipById(a).stream()).filter(a -> a.getInterval().intersects(TimelineInterval.ofPoint(position))).map(a -> a.getId()).collect(Collectors.toList());
        selectedNodeRepository.addSelectedClips(newSelectedClips);
    });
}
Also used : SubtimelineSelectWindowOpener(com.helospark.tactview.ui.javafx.menu.defaultmenus.subtimeline.SubtimelineSelectWindowOpener) AlertDialogFactory(com.helospark.tactview.ui.javafx.stylesheet.AlertDialogFactory) Scene(javafx.scene.Scene) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) InpointMarker(com.helospark.tactview.core.timeline.marker.markers.InpointMarker) ExposedDescriptorDescriptor(com.helospark.tactview.core.timeline.subtimeline.ExposedDescriptorDescriptor) GeneralMarker(com.helospark.tactview.core.timeline.marker.markers.GeneralMarker) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) ArrayList(java.util.ArrayList) Configuration(com.helospark.lightdi.annotation.Configuration) KeyCombination(javafx.scene.input.KeyCombination) Order(com.helospark.lightdi.annotation.Order) SeparatorMenuContribution(com.helospark.tactview.ui.javafx.menu.SeparatorMenuContribution) BigDecimal(java.math.BigDecimal) UiCutHandler(com.helospark.tactview.ui.javafx.uicomponents.UiCutHandler) CurrentlyPressedKeyRepository(com.helospark.tactview.ui.javafx.key.CurrentlyPressedKeyRepository) CopyPasteRepository(com.helospark.tactview.ui.javafx.repository.CopyPasteRepository) Bean(com.helospark.lightdi.annotation.Bean) SelectableMenuContribution(com.helospark.tactview.ui.javafx.menu.SelectableMenuContribution) UiTimelineManager(com.helospark.tactview.ui.javafx.UiTimelineManager) OutpointMarker(com.helospark.tactview.core.timeline.marker.markers.OutpointMarker) HotKeyRepository(com.helospark.tactview.ui.javafx.hotkey.HotKeyRepository) KeyCode(javafx.scene.input.KeyCode) SelectedNodeRepository(com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository) SubtimelineFromTimelineFactory(com.helospark.tactview.core.timeline.subtimeline.SubtimelineFromTimelineFactory) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) TimelineState(com.helospark.tactview.ui.javafx.uicomponents.TimelineState) Set(java.util.Set) PreferencesPage(com.helospark.tactview.ui.javafx.preferences.PreferencesPage) Collectors(java.util.stream.Collectors) ReplaceTimelineWithSubtimelineCommand(com.helospark.tactview.ui.javafx.commands.impl.ReplaceTimelineWithSubtimelineCommand) TimelineInterval(com.helospark.tactview.core.timeline.TimelineInterval) UiLoadHandler(com.helospark.tactview.ui.javafx.save.UiLoadHandler) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) List(java.util.List) LinkClipRepository(com.helospark.tactview.core.timeline.LinkClipRepository) ScenePostProcessor(com.helospark.tactview.ui.javafx.scenepostprocessor.ScenePostProcessor) HotKeyRemapWindow(com.helospark.tactview.ui.javafx.hotkey.HotKeyRemapWindow) StylesheetAdderService(com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) Optional(java.util.Optional) ProjectRepository(com.helospark.tactview.core.repository.ProjectRepository) RestartDialogOpener(com.helospark.tactview.ui.javafx.plugin.RestartDialogOpener) MarkerRepository(com.helospark.tactview.core.timeline.marker.MarkerRepository) DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 5 with TimelineManagerAccessor

use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.

the class MoveToContextMenuChainItem method createMoveToLeftMenuItem.

private MenuItem createMoveToLeftMenuItem(ClipContextMenuChainItemRequest request) {
    MenuItem moveToLeftMenuItem = new MenuItem("to furthest left");
    moveToLeftMenuItem.setOnAction(e -> {
        ClipToLeftCommand clipMovedCommand = ClipToLeftCommand.builder().withAdditionalClipIds(request.getAllClips().stream().map(a -> a.getId()).collect(Collectors.toList())).withClipId(request.getPrimaryClip().getId()).withTimelineManager(timelineManagerAccessor).build();
        ClipToLeftCommand commandResult = commandInterpreter.sendWithResult(clipMovedCommand).join();
        if (!commandResult.wasOperationSuccessful()) {
            Alert alert = alertDialogFactory.createSimpleAlertWithTitleAndContent(AlertType.ERROR, "Cannot move clip to left", "Cannot move clip to left");
            alert.showAndWait();
        }
    });
    return moveToLeftMenuItem;
}
Also used : AlertDialogFactory(com.helospark.tactview.ui.javafx.stylesheet.AlertDialogFactory) Component(com.helospark.lightdi.annotation.Component) Alert(javafx.scene.control.Alert) MenuItem(javafx.scene.control.MenuItem) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Collectors(java.util.stream.Collectors) ClipMovedCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipMovedCommand) Menu(javafx.scene.control.Menu) Order(com.helospark.lightdi.annotation.Order) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) BigDecimal(java.math.BigDecimal) AlertType(javafx.scene.control.Alert.AlertType) StylesheetAdderService(com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) ClipToLeftCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipToLeftCommand) MoveByUnitService(com.helospark.tactview.ui.javafx.commands.impl.service.MoveByUnitService) TextInputDialog(javafx.scene.control.TextInputDialog) ClipToRightCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipToRightCommand) Optional(java.util.Optional) Direction(com.helospark.tactview.ui.javafx.commands.impl.service.MoveByUnitService.Direction) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) Alert(javafx.scene.control.Alert) ClipToLeftCommand(com.helospark.tactview.ui.javafx.commands.impl.ClipToLeftCommand)

Aggregations

TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)7 UiCommandInterpreterService (com.helospark.tactview.ui.javafx.UiCommandInterpreterService)6 Order (com.helospark.lightdi.annotation.Order)5 Collectors (java.util.stream.Collectors)5 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)4 AlertDialogFactory (com.helospark.tactview.ui.javafx.stylesheet.AlertDialogFactory)4 List (java.util.List)4 Optional (java.util.Optional)4 MenuItem (javafx.scene.control.MenuItem)4 Bean (com.helospark.lightdi.annotation.Bean)3 Component (com.helospark.lightdi.annotation.Component)3 Configuration (com.helospark.lightdi.annotation.Configuration)3 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)3 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)3 CopyPasteRepository (com.helospark.tactview.ui.javafx.repository.CopyPasteRepository)3 SelectedNodeRepository (com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository)3 StylesheetAdderService (com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService)3 BigDecimal (java.math.BigDecimal)3 Qualifier (com.helospark.lightdi.annotation.Qualifier)2 EffectFactoryChain (com.helospark.tactview.core.timeline.EffectFactoryChain)2