Search in sources :

Example 6 with TimelineChannel

use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.

the class FakeUi method dragFileToTimeline.

public TimelineClip dragFileToTimeline(File testFile, TimelinePosition position) {
    TimelineChannel channel = timelineManagerAccessor.getChannels().get(0);
    AddClipRequest request = AddClipRequest.builder().withChannelId(channel.getId()).withFilePath(testFile.getAbsolutePath()).withPosition(position).build();
    return timelineManagerAccessor.addClip(request);
}
Also used : TimelineChannel(com.helospark.tactview.core.timeline.TimelineChannel) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest)

Example 7 with TimelineChannel

use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.

the class FakeUi method dragProceduralClipToChannel.

public TimelineClip dragProceduralClipToChannel(String proceduralClipId, TimelinePosition position, int channelIndex) {
    TimelineChannel channel = timelineManagerAccessor.getChannels().get(channelIndex);
    AddClipRequest request = AddClipRequest.builder().withChannelId(channel.getId()).withFilePath(null).withPosition(position).withProceduralClipId(proceduralClipId).build();
    return timelineManagerAccessor.addClip(request);
}
Also used : TimelineChannel(com.helospark.tactview.core.timeline.TimelineChannel) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest)

Example 8 with TimelineChannel

use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.

the class ChannelContextMenuAppender method selectClipsInTabsMenuItem.

private MenuItem selectClipsInTabsMenuItem(String channelId) {
    MenuItem menuItem = new MenuItem("Select clips on channel");
    menuItem.setOnAction(e -> {
        Optional<TimelineChannel> currentChannelIndex = timelineManager.findChannelWithId(channelId);
        if (currentChannelIndex.isPresent()) {
            selectedNodeRepository.clearAllSelectedItems();
            selectedNodeRepository.addSelectedClips(currentChannelIndex.get().getAllClipId());
        }
    });
    return menuItem;
}
Also used : TimelineChannel(com.helospark.tactview.core.timeline.TimelineChannel) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 9 with TimelineChannel

use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.

the class TimelineCanvasOnDragOverHandler method getInsertBefore.

private Optional<TimelineClip> getInsertBefore(TimelineCanvasOnDragOverHandlerRequest request, String channelId) {
    if (!request.selectedElement.isPresent()) {
        return Optional.empty();
    }
    if (!request.selectedElement.get().elementType.equals(TimelineUiCacheType.CLIP)) {
        return Optional.empty();
    }
    if (!request.channel.isPresent()) {
        return Optional.empty();
    }
    String currentlyDraggedClipId = dragRepository.currentlyDraggedClip().getClipIds().get(0);
    Optional<TimelineChannel> optionalChannelForClip = timelineAccessor.findChannelForClipId(currentlyDraggedClipId);
    if (!optionalChannelForClip.isPresent()) {
        return Optional.empty();
    }
    TimelineChannel timelineChannel = optionalChannelForClip.get();
    if (!(request.channel.isPresent() && timelineChannel.getId().equals(channelId))) {
        return Optional.empty();
    }
    for (var clip : request.channel.get().getAllClips()) {
        if (selectedNodeRepository.getSelectedClipIds().contains(clip.getId())) {
            continue;
        }
        if (dragRepository.currentlyDraggedClip().getClipIds().contains(clip.getId())) {
            continue;
        }
        if (Math.abs(timelineState.secondsToPixelsWidthZoomAndTranslate(clip.getInterval().getStartPosition()) - request.getEventX()) < 10) {
            return Optional.ofNullable(clip);
        }
    }
    return Optional.empty();
}
Also used : TimelineChannel(com.helospark.tactview.core.timeline.TimelineChannel)

Example 10 with TimelineChannel

use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.

the class TimelineCanvas method getChannelsHeights.

public List<ChannelHeightResponse> getChannelsHeights() {
    List<ChannelHeightResponse> result = new ArrayList<>();
    double channelStartY = TIMELINE_TIMESCALE_HEIGHT + CHANNEL_PADDING;
    for (int i = 0; i < timelineAccessor.getChannels().size(); ++i) {
        TimelineChannel currentChannel = timelineAccessor.getChannels().get(i);
        double clipHeight = calculateHeight(currentChannel) + CHANNEL_PADDING * 2;
        double top = channelStartY;
        double bottom = channelStartY + clipHeight;
        result.add(new ChannelHeightResponse(top, bottom, currentChannel));
        channelStartY += clipHeight;
    }
    return result;
}
Also used : TimelineChannel(com.helospark.tactview.core.timeline.TimelineChannel) ChannelHeightResponse(com.helospark.tactview.ui.javafx.uicomponents.canvasdraw.domain.ChannelHeightResponse) ArrayList(java.util.ArrayList)

Aggregations

TimelineChannel (com.helospark.tactview.core.timeline.TimelineChannel)19 ArrayList (java.util.ArrayList)7 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)6 TimelineInterval (com.helospark.tactview.core.timeline.TimelineInterval)6 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)6 StatelessEffect (com.helospark.tactview.core.timeline.StatelessEffect)3 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)3 TimelineUiCacheElement (com.helospark.tactview.ui.javafx.uicomponents.canvasdraw.domain.TimelineUiCacheElement)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Component (com.helospark.lightdi.annotation.Component)2 CloneRequestMetadata (com.helospark.tactview.core.clone.CloneRequestMetadata)2 AddClipRequest (com.helospark.tactview.core.timeline.AddClipRequest)2 AddExistingClipRequest (com.helospark.tactview.core.timeline.AddExistingClipRequest)2 ClipChannelIdPair (com.helospark.tactview.core.timeline.ClipChannelIdPair)2 NotificationMessage (com.helospark.tactview.core.timeline.message.NotificationMessage)2 UiCommandInterpreterService (com.helospark.tactview.ui.javafx.UiCommandInterpreterService)2 AddClipsCommand (com.helospark.tactview.ui.javafx.commands.impl.AddClipsCommand)2 AddExistingClipsCommand (com.helospark.tactview.ui.javafx.commands.impl.AddExistingClipsCommand)2 ClipDragInformation (com.helospark.tactview.ui.javafx.repository.drag.ClipDragInformation)2