use of com.helospark.tactview.ui.javafx.UiCommandInterpreterService in project tactview by helospark.
the class StandardClipContextMenuChainItemConfiguration method deleteAllEffectsMenuItem.
@Bean
@Order(102)
public ClipContextMenuChainItem deleteAllEffectsMenuItem(CopyPasteRepository copyPasteRepository, UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager) {
return alwaysSupportedContextMenuItem(request -> {
MenuItem deleteEffectsFromClipMenuItem = new MenuItem("Delete all effects");
deleteEffectsFromClipMenuItem.setOnAction(e -> {
List<RemoveEffectCommand> removeEffectsCommand = request.getPrimaryClip().getEffects().stream().map(effect -> new RemoveEffectCommand(timelineManager, effect.getId())).collect(Collectors.toList());
commandInterpreter.sendWithResult(new CompositeCommand(removeEffectsCommand));
});
if (request.getPrimaryClip().getEffects().isEmpty()) {
deleteEffectsFromClipMenuItem.setDisable(true);
}
return deleteEffectsFromClipMenuItem;
});
}
use of com.helospark.tactview.ui.javafx.UiCommandInterpreterService 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