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);
});
}
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;
});
}
Aggregations