Search in sources :

Example 16 with DefaultMenuContribution

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

the class DefaultEditMenuItemConfiguration method jumpToEndOfCurrentClipMenuItem.

@Bean
@Order(1907)
public SelectableMenuContribution jumpToEndOfCurrentClipMenuItem(UiTimelineManager uiTimelineManager, TimelineManagerAccessor timelineManager, SelectedNodeRepository selectedNodeRepository) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("jumpToClipEnd", new KeyCodeCombination(KeyCode.PERIOD, KeyCombination.CONTROL_DOWN), "Jump to end of selected clip").getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, JUMP_ROOT, "Jump to end of selected clip"), event -> {
        Optional<String> primaryClip = selectedNodeRepository.getPrimarySelectedClip();
        if (primaryClip.isPresent()) {
            Optional<TimelineClip> clip = timelineManager.findClipById(primaryClip.get());
            uiTimelineManager.jumpAbsolute(clip.get().getInterval().getEndPosition().getSeconds());
        }
    }, combination);
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 17 with DefaultMenuContribution

use of com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution 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);
    });
}
Also used : SubtimelineSelectWindowOpener(com.helospark.tactview.ui.javafx.menu.defaultmenus.subtimeline.SubtimelineSelectWindowOpener) AlertDialogFactory(com.helospark.tactview.ui.javafx.stylesheet.AlertDialogFactory) Scene(javafx.scene.Scene) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) InpointMarker(com.helospark.tactview.core.timeline.marker.markers.InpointMarker) ExposedDescriptorDescriptor(com.helospark.tactview.core.timeline.subtimeline.ExposedDescriptorDescriptor) GeneralMarker(com.helospark.tactview.core.timeline.marker.markers.GeneralMarker) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) ArrayList(java.util.ArrayList) Configuration(com.helospark.lightdi.annotation.Configuration) KeyCombination(javafx.scene.input.KeyCombination) Order(com.helospark.lightdi.annotation.Order) SeparatorMenuContribution(com.helospark.tactview.ui.javafx.menu.SeparatorMenuContribution) BigDecimal(java.math.BigDecimal) UiCutHandler(com.helospark.tactview.ui.javafx.uicomponents.UiCutHandler) CurrentlyPressedKeyRepository(com.helospark.tactview.ui.javafx.key.CurrentlyPressedKeyRepository) CopyPasteRepository(com.helospark.tactview.ui.javafx.repository.CopyPasteRepository) Bean(com.helospark.lightdi.annotation.Bean) SelectableMenuContribution(com.helospark.tactview.ui.javafx.menu.SelectableMenuContribution) UiTimelineManager(com.helospark.tactview.ui.javafx.UiTimelineManager) OutpointMarker(com.helospark.tactview.core.timeline.marker.markers.OutpointMarker) HotKeyRepository(com.helospark.tactview.ui.javafx.hotkey.HotKeyRepository) KeyCode(javafx.scene.input.KeyCode) SelectedNodeRepository(com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository) SubtimelineFromTimelineFactory(com.helospark.tactview.core.timeline.subtimeline.SubtimelineFromTimelineFactory) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) TimelineState(com.helospark.tactview.ui.javafx.uicomponents.TimelineState) Set(java.util.Set) PreferencesPage(com.helospark.tactview.ui.javafx.preferences.PreferencesPage) Collectors(java.util.stream.Collectors) ReplaceTimelineWithSubtimelineCommand(com.helospark.tactview.ui.javafx.commands.impl.ReplaceTimelineWithSubtimelineCommand) TimelineInterval(com.helospark.tactview.core.timeline.TimelineInterval) UiLoadHandler(com.helospark.tactview.ui.javafx.save.UiLoadHandler) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) List(java.util.List) LinkClipRepository(com.helospark.tactview.core.timeline.LinkClipRepository) ScenePostProcessor(com.helospark.tactview.ui.javafx.scenepostprocessor.ScenePostProcessor) HotKeyRemapWindow(com.helospark.tactview.ui.javafx.hotkey.HotKeyRemapWindow) StylesheetAdderService(com.helospark.tactview.ui.javafx.stylesheet.StylesheetAdderService) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) Optional(java.util.Optional) ProjectRepository(com.helospark.tactview.core.repository.ProjectRepository) RestartDialogOpener(com.helospark.tactview.ui.javafx.plugin.RestartDialogOpener) MarkerRepository(com.helospark.tactview.core.timeline.marker.MarkerRepository) DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 18 with DefaultMenuContribution

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

the class DefaultEditMenuItemConfiguration method selectClipsToLeftContextMenuItem.

@Bean
@Order(1801)
public SelectableMenuContribution selectClipsToLeftContextMenuItem(SelectedNodeRepository selectedNodeRepository, TimelineManagerAccessor timelineManager, TimelineState state) {
    return new DefaultMenuContribution(List.of(EDIT_ROOT, SELECT_ROOT, "Clips to _left"), 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().getStartPosition().isGreaterThan(playbackPosition)) {
                    clipsIds.add(clip.getId());
                }
            }
        }
        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 19 with DefaultMenuContribution

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

the class DefaultWindowMenuItemConfiguration method loadLayoutMenuItem.

@Bean
@Order(3998)
public SelectableMenuContribution loadLayoutMenuItem(MessagingService messagingService, AlertDialogFactory alertDialogFactory) {
    return new DefaultMenuContribution(List.of(WINDOW_MENU_ITEM, "Load layout"), e -> {
        try {
            FileChooser fileChooser = new FileChooser();
            fileChooser.setSelectedExtensionFilter(new ExtensionFilter("TactView layout file", TACTVIEW_LAYOUT_EXTENSION));
            fileChooser.setTitle("Open Layout");
            File file = fileChooser.showOpenDialog(JavaFXUiMain.STAGE);
            if (file != null) {
                try (var inputStream = new FileInputStream(file)) {
                    DetachableTabPaneLoadModel result = objectMapper.readValue(inputStream, DetachableTabPaneLoadModel.class);
                    dockableTabRepository.loadAndSetModelToParent(result);
                }
            }
        } catch (Exception e1) {
            alertDialogFactory.showExceptionDialog("Unable to load layout", e1);
            LOGGER.error("Unable to load layout", e1);
        }
    });
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) ExtensionFilter(javafx.stage.FileChooser.ExtensionFilter) FileChooser(javafx.stage.FileChooser) DetachableTabPaneLoadModel(com.helospark.tactview.ui.javafx.tiwulfx.com.panemu.tiwulfx.control.DetachableTabPaneLoadModel) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) 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