use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.
the class MoveToContextMenuChainItem method createMoveToRightMenuItem.
private MenuItem createMoveToRightMenuItem(ClipContextMenuChainItemRequest request) {
MenuItem moveToLeftMenuItem = new MenuItem("to furthest right");
moveToLeftMenuItem.setOnAction(e -> {
ClipToRightCommand clipMovedCommand = ClipToRightCommand.builder().withAdditionalClipIds(request.getAllClips().stream().map(a -> a.getId()).collect(Collectors.toList())).withClipId(request.getPrimaryClip().getId()).withTimelineManager(timelineManagerAccessor).build();
ClipToRightCommand commandResult = commandInterpreter.sendWithResult(clipMovedCommand).join();
if (!commandResult.wasOperationSuccessful()) {
Alert alert = alertDialogFactory.createSimpleAlertWithTitleAndContent(AlertType.ERROR, "Cannot move clip to right", "Cannot move clip to right");
alert.showAndWait();
}
});
return moveToLeftMenuItem;
}
use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.
the class TimelineManagerAccessorFactory method createAccessor.
public TimelineManagerAccessor createAccessor(TimelineChannelsState timelineState) {
TimelineManagerAccessor result = new TimelineManagerAccessor(messagingService, clipFactoryChain, effectFactoryChain, linkClipRepository, timelineState, longProcessRequestor, projectRepository);
result.postConstruct();
return result;
}
use of com.helospark.tactview.core.timeline.TimelineManagerAccessor in project tactview by helospark.
the class TactviewInitializationCallback method call.
@Override
public void call(String[] args) {
boolean initialized = false;
try {
Optional<String> optionalFileName = Arrays.stream(args).filter(a -> !a.startsWith("-")).findFirst();
if (optionalFileName.isPresent()) {
File file = new File(optionalFileName.get());
LOGGER.debug("Application launched with " + Arrays.toString(args));
if (file.exists()) {
if (file.getName().endsWith(".tvs")) {
LOGGER.info("Loading save file " + file.getAbsolutePath());
saveAndLoadHandler.load(new LoadRequest(file.getAbsolutePath()));
currentProjectSavedFileRepository.setCurrentSavedFile(file.getAbsolutePath());
initialized = true;
} else {
LOGGER.info("Loading media file " + file.getAbsolutePath());
projectInitializer.clearAndInitialize();
String firstChannelId = timelineManagerAccessor.getChannels().get(0).getId();
AddClipsCommand addClipCommand = AddClipsCommand.builder().withChannelId(firstChannelId).withPosition(TimelinePosition.ofZero()).withTimelineManager(timelineManagerAccessor).withFilePaths(List.of(file.getAbsolutePath())).build();
commandInterpreterService.synchronousSend(addClipCommand);
initialized = true;
}
}
}
} catch (Exception e) {
alertDialogFactory.createErrorAlertWithStackTrace("Initialization failed", e);
}
if (!initialized) {
projectInitializer.clearAndInitialize();
}
}
use of com.helospark.tactview.core.timeline.TimelineManagerAccessor 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.core.timeline.TimelineManagerAccessor in project tactview by helospark.
the class MoveToContextMenuChainItem method createMoveToLeftMenuItem.
private MenuItem createMoveToLeftMenuItem(ClipContextMenuChainItemRequest request) {
MenuItem moveToLeftMenuItem = new MenuItem("to furthest left");
moveToLeftMenuItem.setOnAction(e -> {
ClipToLeftCommand clipMovedCommand = ClipToLeftCommand.builder().withAdditionalClipIds(request.getAllClips().stream().map(a -> a.getId()).collect(Collectors.toList())).withClipId(request.getPrimaryClip().getId()).withTimelineManager(timelineManagerAccessor).build();
ClipToLeftCommand commandResult = commandInterpreter.sendWithResult(clipMovedCommand).join();
if (!commandResult.wasOperationSuccessful()) {
Alert alert = alertDialogFactory.createSimpleAlertWithTitleAndContent(AlertType.ERROR, "Cannot move clip to left", "Cannot move clip to left");
alert.showAndWait();
}
});
return moveToLeftMenuItem;
}
Aggregations