Search in sources :

Example 26 with Order

use of com.helospark.lightdi.annotation.Order 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 27 with Order

use of com.helospark.lightdi.annotation.Order 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 28 with Order

use of com.helospark.lightdi.annotation.Order 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)

Example 29 with Order

use of com.helospark.lightdi.annotation.Order in project tactview by helospark.

the class StandardClipContextMenuChainItemConfiguration method rippleDeleteMenuItem.

@Bean
@Order(109)
public ClipContextMenuChainItem rippleDeleteMenuItem(RemoveClipService removeClipService) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem deleteClipMenuItem = new MenuItem("Ripple delete");
        deleteClipMenuItem.setOnAction(e -> removeClipService.rippleDeleteClips(request.getAllClips().stream().map(a -> a.getId()).collect(Collectors.toList()), TimelineEditMode.ALL_CHANNEL_RIPPLE));
        return deleteClipMenuItem;
    });
}
Also used : EffectFactoryChain(com.helospark.tactview.core.timeline.EffectFactoryChain) Qualifier(com.helospark.lightdi.annotation.Qualifier) AddScaleCommand(com.helospark.tactview.ui.javafx.commands.impl.AddScaleCommand) TimelineEditMode(com.helospark.tactview.ui.javafx.repository.timelineeditmode.TimelineEditMode) MenuItem(javafx.scene.control.MenuItem) SelectedNodeRepository(com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository) UiCommandInterpreterService(com.helospark.tactview.ui.javafx.UiCommandInterpreterService) CompositeCommand(com.helospark.tactview.ui.javafx.commands.impl.CompositeCommand) RemoveEffectCommand(com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand) RemoveClipService(com.helospark.tactview.ui.javafx.RemoveClipService) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) TimelineClip(com.helospark.tactview.core.timeline.TimelineClip) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) Configuration(com.helospark.lightdi.annotation.Configuration) Order(com.helospark.lightdi.annotation.Order) List(java.util.List) EffectFactory(com.helospark.tactview.core.timeline.effect.EffectFactory) TimelineManagerAccessor(com.helospark.tactview.core.timeline.TimelineManagerAccessor) ProjectRepository(com.helospark.tactview.core.repository.ProjectRepository) CopyPasteRepository(com.helospark.tactview.ui.javafx.repository.CopyPasteRepository) Bean(com.helospark.lightdi.annotation.Bean) MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 30 with Order

use of com.helospark.lightdi.annotation.Order in project tactview by helospark.

the class StandardClipContextMenuChainItemConfiguration method pasteMenuItem.

@Bean
@Order(101)
public ClipContextMenuChainItem pasteMenuItem(CopyPasteRepository copyPasteRepository) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem pasteEffectOnClipMenuItem = new MenuItem("Paste effect on clip");
        pasteEffectOnClipMenuItem.setOnAction(e -> {
            if (copyPasteRepository.isEffectOnClipboard()) {
                copyPasteRepository.pasteOnExistingClips(List.of(request.getPrimaryClip().getId()));
            }
        });
        if (!copyPasteRepository.isEffectOnClipboard()) {
            pasteEffectOnClipMenuItem.setDisable(true);
        }
        return pasteEffectOnClipMenuItem;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)36 Order (com.helospark.lightdi.annotation.Order)36 DefaultMenuContribution (com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution)19 MenuItem (javafx.scene.control.MenuItem)17 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)14 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)9 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)6 Configuration (com.helospark.lightdi.annotation.Configuration)4 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)4 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)4 UiCommandInterpreterService (com.helospark.tactview.ui.javafx.UiCommandInterpreterService)4 CopyPasteRepository (com.helospark.tactview.ui.javafx.repository.CopyPasteRepository)4 SelectedNodeRepository (com.helospark.tactview.ui.javafx.repository.SelectedNodeRepository)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 Qualifier (com.helospark.lightdi.annotation.Qualifier)3 EffectFactoryChain (com.helospark.tactview.core.timeline.EffectFactoryChain)3 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)3 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)3 RemoveClipService (com.helospark.tactview.ui.javafx.RemoveClipService)3