Search in sources :

Example 1 with SelectedNodeRepository

use of com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository 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 2 with SelectedNodeRepository

use of com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository in project tactview by helospark.

the class StandardClipContextMenuChainItemConfiguration method scaleToFrameMenuItem.

@Bean
@Order(0)
public ClipContextMenuChainItem scaleToFrameMenuItem(UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager, ProjectRepository projectRepository, @Qualifier("scaleEffect") EffectFactory scaleFactory, EffectFactoryChain effectFactoryChain, SelectedNodeRepository selectedNodeRepository) {
    return typeSupportingContextMenuItem(VisualTimelineClip.class, request -> {
        MenuItem scaleToImageMenuItem = new MenuItem("Scale to frame");
        scaleToImageMenuItem.setOnAction(e -> {
            List<AddScaleCommand> commands = request.getAllClips().stream().map(a -> a.getId()).map(clipId -> AddScaleCommand.builder().withClipId(clipId).withProjectRepository(projectRepository).withScaleEffectFactory(scaleFactory).withTimelineManager(timelineManager).withEffectFactoryChain(effectFactoryChain).build()).collect(Collectors.toList());
            if (commands.size() > 0) {
                commandInterpreter.sendWithResult(new CompositeCommand(commands));
            }
        });
        return scaleToImageMenuItem;
    });
}
Also used : EffectFactoryChain(com.helospark.tactview.core.timeline.EffectFactoryChain) Qualifier(com.helospark.lightdi.annotation.Qualifier) AddScaleCommand(com.helospark.tactview.ui.javafx.commands.impl.AddScaleCommand) TimelineEditMode(com.helospark.tactview.ui.javafx.repository.timelineeditmode.TimelineEditMode) MenuItem(javafx.scene.control.MenuItem) SelectedNodeRepository(com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand) RemoveEffectCommand(com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand) RemoveClipService(com.helospark.tactview.ui.javafx.RemoveClipService) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) Configuration(com.helospark.lightdi.annotation.Configuration) Order(com.helospark.lightdi.annotation.Order) List(java.util.List) EffectFactory(com.helospark.tactview.core.timeline.effect.EffectFactory) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) ProjectRepository(com.helospark.tactview.core.repository.ProjectRepository) CopyPasteRepository(com.helospark.tactview.ui.javafx.repository.CopyPasteRepository) Bean(com.helospark.lightdi.annotation.Bean) MenuItem(javafx.scene.control.MenuItem) AddScaleCommand(com.helospark.tactview.ui.javafx.commands.impl.AddScaleCommand) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)2 Configuration (com.helospark.lightdi.annotation.Configuration)2 Order (com.helospark.lightdi.annotation.Order)2 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)2 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)2 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)2 UiCommandInterpreterService (com.helospark.tactview.ui.javafx.UiCommandInterpreterService)2 CopyPasteRepository (com.helospark.tactview.ui.javafx.repository.CopyPasteRepository)2 SelectedNodeRepository (com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Qualifier (com.helospark.lightdi.annotation.Qualifier)1 EffectFactoryChain (com.helospark.tactview.core.timeline.EffectFactoryChain)1 LinkClipRepository (com.helospark.tactview.core.timeline.LinkClipRepository)1 TimelineInterval (com.helospark.tactview.core.timeline.TimelineInterval)1 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)1 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)1 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)1 MarkerRepository (com.helospark.tactview.core.timeline.marker.MarkerRepository)1 GeneralMarker (com.helospark.tactview.core.timeline.marker.markers.GeneralMarker)1