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