Search in sources :

Example 16 with Order

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

the class StandardEffectContextMenuChainItemConfiguration method moveDownItem.

@Bean
@Order(91)
public EffectContextMenuChainItem moveDownItem(UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem moveDownClip = new MenuItem("Move down");
        int index = timelineManager.findEffectChannel(request.getEffect().getId());
        int numberOfEffectChannels = timelineManager.getNumberOfEffectChannels(request.getEffect().getId()) - 1;
        System.out.println("Down index: " + index + " " + numberOfEffectChannels);
        if (index >= numberOfEffectChannels) {
            moveDownClip.setDisable(true);
        } else {
            moveDownClip.setOnAction(e -> commandInterpreter.sendWithResult(new MoveEffectToChannelCommand(timelineManager, request.getEffect().getId(), index + 1)));
        }
        return moveDownClip;
    });
}
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 17 with Order

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

the class StandardEffectContextMenuChainItemConfiguration method maximizeMenuItem.

@Bean
@Order(120)
public EffectContextMenuChainItem maximizeMenuItem(ExtendsClipToMaximizeLengthService extendsClipToMaximizeLengthService, TimelineManagerAccessor timelineManager) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem maximizeClipMenuItem = new MenuItem("Maximize");
        timelineManager.findClipForEffect(request.getEffect().getId()).ifPresent(clip -> {
            maximizeClipMenuItem.setOnAction(e -> extendsClipToMaximizeLengthService.extendEffectToClipSize(clip.getId(), request.getEffect()));
        });
        return maximizeClipMenuItem;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 18 with Order

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

the class StandardEffectContextMenuChainItemConfiguration method copyMenuItem.

@Bean
@Order(100)
public EffectContextMenuChainItem copyMenuItem(CopyPasteRepository copyPasteRepository) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem copyClip = new MenuItem("Copy");
        copyClip.setOnAction(e -> copyPasteRepository.copyEffect(request.getEffect().getId()));
        return copyClip;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 19 with Order

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

the class DefaultEditMenuItemConfiguration method addChapterMenuItem.

@Bean
@Order(1950)
public SelectableMenuContribution addChapterMenuItem(AlertDialogFactory dialogFactory, TimelineState timelineState, MarkerRepository chapterRepository) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("addChapter", new KeyCodeCombination(KeyCode.P, KeyCodeCombination.CONTROL_DOWN), "Add chapter").getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, CHAPTER_ROOT, "Add chapter at current position"), event -> {
        TimelinePosition position = timelineState.getPlaybackPosition();
        Optional<String> result = dialogFactory.showTextInputDialog("Add chapter", "Label of the chapter", "Chapter x");
        if (result.isPresent()) {
            chapterRepository.addChapter(position, result.get());
        }
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 20 with Order

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

the class DefaultEditMenuItemConfiguration method cutAllAtCurrentPositionMenuItem.

@Bean
@Order(1910)
public SelectableMenuContribution cutAllAtCurrentPositionMenuItem(AlertDialogFactory dialogFactory, TimelineState timelineState, UiCutHandler uiCutHandler) {
    String title = "Cut at current position";
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("cutAllAtCurrentPosition", new KeyCodeCombination(KeyCode.K, KeyCodeCombination.CONTROL_DOWN), title).getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, CUT_MENU_ITEM, title), event -> {
        uiCutHandler.cutAllAtCurrentPosition();
    }, 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)

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