Search in sources :

Example 1 with DefaultMenuContribution

use of com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method selectAllClipsContextMenuItem.

@Bean
@Order(1800)
public SelectableMenuContribution selectAllClipsContextMenuItem(SelectedNodeRepository selectedNodeRepository, TimelineManagerAccessor timelineManager) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("selectAllClips", new KeyCodeCombination(KeyCode.A, KeyCombination.CONTROL_DOWN), "Select all clips").getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, SELECT_ROOT, "_All clips"), event -> {
        selectedNodeRepository.clearAllSelectedItems();
        selectedNodeRepository.addSelectedClips(timelineManager.getAllClipIds());
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 2 with DefaultMenuContribution

use of com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method selectClipsToRightContextMenuItem.

@Bean
@Order(1802)
public SelectableMenuContribution selectClipsToRightContextMenuItem(SelectedNodeRepository selectedNodeRepository, TimelineManagerAccessor timelineManager, TimelineState state) {
    return new DefaultMenuContribution(List.of(EDIT_ROOT, SELECT_ROOT, "Clips to _right"), event -> {
        TimelinePosition playbackPosition = state.getPlaybackPosition();
        selectedNodeRepository.clearAllSelectedItems();
        List<String> clipsIds = new ArrayList<>();
        for (var channel : timelineManager.getChannels()) {
            for (var clip : channel.getAllClips()) {
                if (!clip.getInterval().getEndPosition().isLessThan(playbackPosition)) {
                    clipsIds.add(clip.getId());
                }
            }
        }
        selectedNodeRepository.clearAllSelectedItems();
        selectedNodeRepository.addSelectedClips(clipsIds);
    });
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) ArrayList(java.util.ArrayList) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 3 with DefaultMenuContribution

use of com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method cutSelectedAtCurrent.

@Bean
@Order(1911)
public SelectableMenuContribution cutSelectedAtCurrent(AlertDialogFactory dialogFactory, TimelineState timelineState, UiCutHandler uiCutHandler) {
    String title = "Set selected endpoint";
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("cutSelectedAtCursor", new KeyCodeCombination(KeyCode.O, KeyCodeCombination.CONTROL_DOWN), title).getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, CUT_MENU_ITEM, title), event -> {
        uiCutHandler.cutSelectedUntilCursor(false);
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 4 with DefaultMenuContribution

use of com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method addInpointMenuItem.

@Bean
@Order(1940)
public SelectableMenuContribution addInpointMenuItem(AlertDialogFactory dialogFactory, TimelineState timelineState, MarkerRepository markerRepository) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("addInpoint", new KeyCodeCombination(KeyCode.I, KeyCodeCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN), "Add inpoint").getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, MARKER, "Add inpoint"), event -> {
        TimelinePosition position = timelineState.getPlaybackPosition();
        markerRepository.addMarker(position, new InpointMarker());
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) InpointMarker(com.helospark.tactview.core.timeline.marker.markers.InpointMarker) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 5 with DefaultMenuContribution

use of com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution in project tactview by helospark.

the class DefaultEditMenuItemConfiguration method addGeneralMarkerMenuItem.

@Bean
@Order(1942)
public SelectableMenuContribution addGeneralMarkerMenuItem(AlertDialogFactory dialogFactory, TimelineState timelineState, MarkerRepository markerRepository) {
    String name = "Add marker";
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey(name, new KeyCodeCombination(KeyCode.M, KeyCodeCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN), name).getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, MARKER, name), event -> {
        TimelinePosition position = timelineState.getPlaybackPosition();
        Optional<String> result = dialogFactory.showTextInputDialog("Add marker", "Label of marker", "Something interesting");
        if (result.isPresent()) {
            markerRepository.addMarker(position, new GeneralMarker(result.get()));
        }
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) GeneralMarker(com.helospark.tactview.core.timeline.marker.markers.GeneralMarker) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)19 Order (com.helospark.lightdi.annotation.Order)19 DefaultMenuContribution (com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution)19 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)14 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)9 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)3 ArrayList (java.util.ArrayList)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 GeneralMarker (com.helospark.tactview.core.timeline.marker.markers.GeneralMarker)2 InpointMarker (com.helospark.tactview.core.timeline.marker.markers.InpointMarker)2 OutpointMarker (com.helospark.tactview.core.timeline.marker.markers.OutpointMarker)2 DetachableTabPaneLoadModel (com.helospark.tactview.ui.javafx.tiwulfx.com.panemu.tiwulfx.control.DetachableTabPaneLoadModel)2 File (java.io.File)2 Configuration (com.helospark.lightdi.annotation.Configuration)1 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)1 LinkClipRepository (com.helospark.tactview.core.timeline.LinkClipRepository)1 TimelineInterval (com.helospark.tactview.core.timeline.TimelineInterval)1 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)1 MarkerRepository (com.helospark.tactview.core.timeline.marker.MarkerRepository)1 ExposedDescriptorDescriptor (com.helospark.tactview.core.timeline.subtimeline.ExposedDescriptorDescriptor)1