Search in sources :

Example 21 with Order

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

the class DefaultEditMenuItemConfiguration method cutSelectedUntilCurrent.

@Bean
@Order(1911)
public SelectableMenuContribution cutSelectedUntilCurrent(AlertDialogFactory dialogFactory, TimelineState timelineState, UiCutHandler uiCutHandler) {
    String title = "Set selected startpoint";
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("cutSelectedUntilCursor", new KeyCodeCombination(KeyCode.I, KeyCodeCombination.CONTROL_DOWN), title).getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, CUT_MENU_ITEM, title), event -> {
        uiCutHandler.cutSelectedUntilCursor(true);
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 22 with Order

use of com.helospark.lightdi.annotation.Order 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 23 with Order

use of com.helospark.lightdi.annotation.Order 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 24 with Order

use of com.helospark.lightdi.annotation.Order 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 25 with Order

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

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)36 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)9 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)6 Configuration (com.helospark.lightdi.annotation.Configuration)4 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)4 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)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 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)3 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)3 RemoveClipService (com.helospark.tactview.ui.javafx.RemoveClipService)3