Search in sources :

Example 41 with Bean

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

the class CommonPropertyValueContextMenuItemConfiguration method addKeyframeItem.

@Bean
@Order(0)
public PropertyValueContextMenuItem addKeyframeItem(UiTimelineManager timelineManager, UiCommandInterpreterService commandInterpreter, EffectParametersRepository effectParametersRepository) {
    return contextMenuEnabledIfKeyframesEnabled(request -> {
        MenuItem addKeyframeMenuItem = new MenuItem("Add keyframe");
        addKeyframeMenuItem.setOnAction(e -> {
            KeyframeAddedRequest keyframeRequest = KeyframeAddedRequest.builder().withDescriptorId(request.effectLine.getDescriptorId()).withGlobalTimelinePosition(timelineManager.getCurrentPosition()).withValue(request.effectLine.getCurrentValueSupplier().get()).withRevertable(true).build();
            commandInterpreter.sendWithResult(new AddKeyframeForPropertyCommand(effectParametersRepository, keyframeRequest));
        });
        return addKeyframeMenuItem;
    });
}
Also used : KeyframeAddedRequest(com.helospark.tactview.core.timeline.message.KeyframeAddedRequest) MenuItem(javafx.scene.control.MenuItem) AddKeyframeForPropertyCommand(com.helospark.tactview.ui.javafx.commands.impl.AddKeyframeForPropertyCommand) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 42 with Bean

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

the class CommonPropertyValueContextMenuItemConfiguration method pasteValue.

@Bean
@Order(-10)
public PropertyValueContextMenuItem pasteValue(UiTimelineManager timelineManager) {
    return allPrimitiveEffectLineSupportingMenuIfRequired(request -> {
        MenuItem pasteKeyframeMenuItem = new MenuItem("Paste");
        pasteKeyframeMenuItem.setOnAction(e -> {
            Clipboard clipboard = Clipboard.getSystemClipboard();
            Object value = clipboard.getContent(RAW_DATA_FORMAT);
            if (value != null) {
                try {
                    request.effectLine.getUpdateFromValue().accept(value);
                } catch (Exception ex) {
                    LOGGER.debug("Trying to paste {} into type {}, which is not supported", value, request.containerDescriptor.getKeyframeableEffect().getClass(), ex);
                }
            }
        });
        return pasteKeyframeMenuItem;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Clipboard(javafx.scene.input.Clipboard) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 43 with Bean

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

the class CommonPropertyValueContextMenuItemConfiguration method resetDefaultsValues.

@Bean
@Order(30)
public PropertyValueContextMenuItem resetDefaultsValues(UiTimelineManager timelineManager, UiCommandInterpreterService commandInterpreter, EffectParametersRepository effectParametersRepository) {
    return alwaysEnableContextMenu(request -> {
        MenuItem resetDefaultsMenuItem = new MenuItem("Reset defaults");
        resetDefaultsMenuItem.setOnAction(e -> {
            commandInterpreter.sendWithResult(new ResetDefaultValuesCommand(effectParametersRepository, request.valueProvider.getId()));
        });
        return resetDefaultsMenuItem;
    });
}
Also used : ResetDefaultValuesCommand(com.helospark.tactview.ui.javafx.commands.impl.ResetDefaultValuesCommand) MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)43 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)13 TimelineClip (com.helospark.tactview.core.timeline.TimelineClip)6 Configuration (com.helospark.lightdi.annotation.Configuration)5 ProjectRepository (com.helospark.tactview.core.repository.ProjectRepository)4 TimelineManagerAccessor (com.helospark.tactview.core.timeline.TimelineManagerAccessor)4 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)4 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)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 KeyframeSupportingDoubleInterpolator (com.helospark.tactview.core.timeline.effect.interpolation.interpolator.KeyframeSupportingDoubleInterpolator)3