Search in sources :

Example 21 with Bean

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

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

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

Example 24 with Bean

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

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

the class StandardGraphElementFactoryConfiguration method fileClipGraphElementFactory.

@Bean
public GraphElementFactory fileClipGraphElementFactory(List<ClipFactory> clipFactories, ClipFactoryChain clipFactoryChain, MessagingService messagingService) {
    return StandardGraphElementFactory.builder().withId("file").withDoesSupport(uri -> uri.startsWith("file://")).withName("File").withCategory(GraphCategory.INPUT).withNeedsInputParam(true).withCreator(graphRequest -> {
        AddClipRequest request = AddClipRequest.builder().withAddClipRequestMetadataKey(Map.of()).withPosition(TimelinePosition.ofZero()).withFilePath(graphRequest.uri.replaceFirst("file://", "")).build();
        VisualTimelineClip clip = (VisualTimelineClip) clipFactoryChain.createClips(request).get(0);
        clip.setInterval(INTERVAL);
        messagingService.sendAsyncMessage(new ClipDescriptorsAdded(clip.getId(), clip.getDescriptors(), clip));
        return new VisualTimelineClipElement(clip);
    }).withRestorer((node, metadata) -> {
        node.get("creatorFactoryId").asText();
        return new VisualTimelineClipElement(node, metadata, (VisualTimelineClip) clipFactoryChain.restoreClip(node.get("clip"), metadata));
    }).build();
}
Also used : TimelineClipType(com.helospark.tactview.core.timeline.TimelineClipType) TactviewPlatform(com.helospark.tactview.core.util.conditional.TactviewPlatform) ConditionalOnPlatform(com.helospark.tactview.core.util.conditional.ConditionalOnPlatform) ClipFactory(com.helospark.tactview.core.timeline.ClipFactory) StatelessVideoEffect(com.helospark.tactview.core.timeline.StatelessVideoEffect) EffectParametersRepository(com.helospark.tactview.core.timeline.effect.EffectParametersRepository) Configuration(com.helospark.lightdi.annotation.Configuration) CreateEffectRequest(com.helospark.tactview.core.timeline.effect.CreateEffectRequest) KeyframeSuccesfullyAddedMessage(com.helospark.tactview.core.timeline.message.KeyframeSuccesfullyAddedMessage) ConditionalOnProperty(com.helospark.lightdi.annotation.ConditionalOnProperty) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest) EffectFactory(com.helospark.tactview.core.timeline.effect.EffectFactory) GraphProvider(com.helospark.tactview.core.timeline.effect.interpolation.provider.GraphProvider) Map(java.util.Map) Bean(com.helospark.lightdi.annotation.Bean) CameraOutputToV4L2LoopbackElement(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.CameraOutputToV4L2LoopbackElement) ProceduralClipFactoryChainItem(com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem) GraphCategory(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.GraphElementFactory.GraphCategory) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) OpencvL4V2LoopbackImplementation(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.camera.OpencvL4V2LoopbackImplementation) ClipDescriptorsAdded(com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded) Collectors(java.util.stream.Collectors) TimelineLength(com.helospark.tactview.core.timeline.TimelineLength) MessagingService(com.helospark.tactview.core.util.messaging.MessagingService) TimelineInterval(com.helospark.tactview.core.timeline.TimelineInterval) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) List(java.util.List) Optional(java.util.Optional) ClipFactoryChain(com.helospark.tactview.core.timeline.ClipFactoryChain) ProceduralVisualClip(com.helospark.tactview.core.timeline.proceduralclip.ProceduralVisualClip) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest) ClipDescriptorsAdded(com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) 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