Search in sources :

Example 26 with Bean

use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.

the class StandardEffectContextMenuChainItemConfiguration method moveUpItem.

@Bean
@Order(90)
public EffectContextMenuChainItem moveUpItem(UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem moveUpClip = new MenuItem("Move up");
        int index = timelineManager.findEffectChannel(request.getEffect().getId());
        System.out.println("Up index: " + index);
        if (index <= 0) {
            moveUpClip.setDisable(true);
        } else {
            moveUpClip.setOnAction(e -> commandInterpreter.sendWithResult(new MoveEffectToChannelCommand(timelineManager, request.getEffect().getId(), index - 1)));
        }
        return moveUpClip;
    });
}
Also used : MoveEffectToChannelCommand(com.helospark.tactview.ui.javafx.commands.impl.MoveEffectToChannelCommand) MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 27 with Bean

use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.

the class StandardEffectContextMenuChainItemConfiguration method deleteMenuItem.

@Bean
@Order(110)
public EffectContextMenuChainItem deleteMenuItem(RemoveEffectService removeEffectService) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem deleteClipMenuItem = new MenuItem("Delete");
        deleteClipMenuItem.setOnAction(e -> removeEffectService.removeEffect(request.getEffect().getId()));
        return deleteClipMenuItem;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 28 with Bean

use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method exportAsYoutubeChapterMenuItem.

@Bean
@Order(1952)
public SelectableMenuContribution exportAsYoutubeChapterMenuItem(MarkerRepository chapterRepository, AlertDialogFactory alertDialogFactory) {
    return new DefaultMenuContribution(List.of(EDIT_ROOT, CHAPTER_ROOT, "Show as Youtube chapter"), event -> {
        String result = "";
        String errors = "";
        int numberOfChapters = 0;
        TimelinePosition previousPosition = null;
        if (chapterRepository.getMarkers().get(TimelinePosition.ofZero()) == null) {
            result += "00:00 Intro\n";
            errors += "[WARN] No chapter is defined in position 00:00, added intro chapter at 0\n";
            previousPosition = TimelinePosition.ofZero();
            ++numberOfChapters;
        }
        for (var chapter : chapterRepository.getMarkers().entrySet()) {
            long allSeconds = chapter.getKey().getSeconds().longValue();
            long minutes = allSeconds / 60;
            long seconds = allSeconds % 60;
            result += (String.format("%02d:%02d %s\n", minutes, seconds, chapter.getValue()));
            ++numberOfChapters;
            if (previousPosition != null && chapter.getKey().subtract(previousPosition).isLessThan(10)) {
                errors += "[ERROR] Chapter at " + minutes + ":" + seconds + " is less than 10s from previous chapter which is unaccaptable by YouTube\n";
            }
            previousPosition = chapter.getKey();
        }
        if (numberOfChapters < 3) {
            errors += "[ERROR] Minimum 3 chapters needed by YouTube";
        }
        alertDialogFactory.showTextDialog("Youtube chapters", "Copy the below in your description to add chapters to Youtube", errors, result);
    });
}
Also used : 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 29 with Bean

use of com.helospark.lightdi.annotation.Bean in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method jumpToEndOfCurrentClipMenuItem.

@Bean
@Order(1907)
public SelectableMenuContribution jumpToEndOfCurrentClipMenuItem(UiTimelineManager uiTimelineManager, TimelineManagerAccessor timelineManager, SelectedNodeRepository selectedNodeRepository) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("jumpToClipEnd", new KeyCodeCombination(KeyCode.PERIOD, KeyCombination.CONTROL_DOWN), "Jump to end of selected clip").getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, JUMP_ROOT, "Jump to end of selected clip"), event -> {
        Optional<String> primaryClip = selectedNodeRepository.getPrimarySelectedClip();
        if (primaryClip.isPresent()) {
            Optional<TimelineClip> clip = timelineManager.findClipById(primaryClip.get());
            uiTimelineManager.jumpAbsolute(clip.get().getInterval().getEndPosition().getSeconds());
        }
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 30 with Bean

use of com.helospark.lightdi.annotation.Bean 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)

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)43 Order (com.helospark.lightdi.annotation.Order)36 DefaultMenuContribution (com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution)19 MenuItem (javafx.scene.control.MenuItem)17 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)14 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)13 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)6 Configuration (com.helospark.lightdi.annotation.Configuration)5 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)4 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)4 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)4 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)4 UiCommandInterpreterService (com.helospark.tactview.ui.javafx.UiCommandInterpreterService)4 CopyPasteRepository (com.helospark.tactview.ui.javafx.repository.CopyPasteRepository)4 SelectedNodeRepository (com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 Qualifier (com.helospark.lightdi.annotation.Qualifier)3 EffectFactoryChain (com.helospark.tactview.core.timeline.EffectFactoryChain)3 KeyframeSupportingDoubleInterpolator (com.helospark.tactview.core.timeline.effect.interpolation.interpolator.KeyframeSupportingDoubleInterpolator)3