Search in sources :

Example 1 with Bean

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

the class StandardClipContextMenuChainItemConfiguration method copyMenuItem.

@Bean
@Order(100)
public ClipContextMenuChainItem copyMenuItem(CopyPasteRepository copyPasteRepository) {
    return alwaysSupportedContextMenuItem(request -> {
        MenuItem copyClip = new MenuItem("Copy");
        copyClip.setOnAction(e -> copyPasteRepository.copyClip(List.of(request.getPrimaryClip().getId())));
        return copyClip;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 2 with Bean

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

the class StandardDoubleInterpolatorFactoryConfiguration method bezierDoubleInterpolator.

@Bean
public StandardDoubleInterpolatorFactory<?> bezierDoubleInterpolator() {
    return new StandardDoubleInterpolatorFactory<>("bezierDoubleInterpolator", BezierDoubleInterpolator.class, (previousProvider, previousInterpolator) -> {
        TreeMap<TimelinePosition, CubicBezierPoint> values = new TreeMap<>();
        double defaultValue = 0.0;
        if (previousInterpolator instanceof KeyframeSupportingDoubleInterpolator) {
            for (var entry : ((KeyframeSupportingDoubleInterpolator) previousInterpolator).getValues().entrySet()) {
                values.put(entry.getKey(), new CubicBezierPoint((Double) entry.getValue(), new Point(-1, 0), new Point(1, 0)));
            }
            defaultValue = ((KeyframeSupportingDoubleInterpolator) previousInterpolator).getDefaultValue();
        }
        BezierDoubleInterpolator result = new BezierDoubleInterpolator(defaultValue, values);
        if (previousInterpolator instanceof KeyframeSupportingDoubleInterpolator) {
            result.setUseKeyframes(((KeyframeSupportingDoubleInterpolator) previousInterpolator).isUsingKeyframes());
        }
        return result;
    });
}
Also used : CubicBezierPoint(com.helospark.tactview.core.util.bezier.CubicBezierPoint) Point(com.helospark.tactview.core.timeline.effect.interpolation.pojo.Point) CubicBezierPoint(com.helospark.tactview.core.util.bezier.CubicBezierPoint) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) TreeMap(java.util.TreeMap) KeyframeSupportingDoubleInterpolator(com.helospark.tactview.core.timeline.effect.interpolation.interpolator.KeyframeSupportingDoubleInterpolator) BezierDoubleInterpolator(com.helospark.tactview.core.timeline.effect.interpolation.interpolator.bezier.BezierDoubleInterpolator) Bean(com.helospark.lightdi.annotation.Bean)

Example 3 with Bean

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

the class CommonPropertyValueContextMenuItemConfiguration method removeAllAndSet.

@Bean
@Order(20)
public PropertyValueContextMenuItem removeAllAndSet(UiTimelineManager timelineManager, EffectParametersRepository effectParametersRepository, UiCommandInterpreterService commandInterpreter) {
    return contextMenuEnabledIfKeyframesEnabled(request -> {
        MenuItem removeAllAndSetMenuItemw = new MenuItem("Remove all and set");
        removeAllAndSetMenuItemw.setOnAction(e -> {
            request.effectLine.removeAllAndSetKeyframe(timelineManager.getCurrentPosition());
        });
        return removeAllAndSetMenuItemw;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 4 with Bean

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

the class CommonPropertyValueContextMenuItemConfiguration method removeKeyframeItem.

@Bean
@Order(10)
public PropertyValueContextMenuItem removeKeyframeItem(UiTimelineManager timelineManager, EffectParametersRepository effectParametersRepository, UiCommandInterpreterService commandInterpreter) {
    return contextMenuEnabledIfKeyframesEnabled(request -> {
        MenuItem removeKeyframeMenuItem = new MenuItem("Remove keyframe");
        removeKeyframeMenuItem.setOnAction(e -> {
            request.effectLine.removeKeyframe(timelineManager.getCurrentPosition());
        });
        return removeKeyframeMenuItem;
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) Order(com.helospark.lightdi.annotation.Order) Bean(com.helospark.lightdi.annotation.Bean)

Example 5 with Bean

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

the class CommonPropertyValueContextMenuItemConfiguration method copyValue.

@Bean
@Order(-20)
public PropertyValueContextMenuItem copyValue(UiTimelineManager timelineManager) {
    return allPrimitiveEffectLineSupportingMenuIfRequired(request -> {
        MenuItem copyKeyframeMenuItem = new MenuItem("Copy");
        copyKeyframeMenuItem.setOnAction(e -> {
            Object currentValue = ((PrimitiveEffectLine) (request.effectLine)).getCurrentValueSupplier().get();
            Clipboard clipboard = Clipboard.getSystemClipboard();
            ClipboardContent content = new ClipboardContent();
            content.put(RAW_DATA_FORMAT, currentValue);
            clipboard.setContent(content);
        });
        return copyKeyframeMenuItem;
    });
}
Also used : ClipboardContent(javafx.scene.input.ClipboardContent) MenuItem(javafx.scene.control.MenuItem) Clipboard(javafx.scene.input.Clipboard) 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