Search in sources :

Example 11 with Order

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

the class DefaultEditMenuItemConfiguration method jumpToBeginningOfCurrentClipMenuItem.

@Bean
@Order(1906)
public SelectableMenuContribution jumpToBeginningOfCurrentClipMenuItem(UiTimelineManager uiTimelineManager, TimelineManagerAccessor timelineManager, SelectedNodeRepository selectedNodeRepository) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("jumpToClipBeginning", new KeyCodeCombination(KeyCode.COMMA, KeyCombination.CONTROL_DOWN), "Jump to beginning of selected clip").getCombination();
    return new DefaultMenuContribution(List.of(EDIT_ROOT, JUMP_ROOT, "Jump to beginning of selected clip"), event -> {
        Optional<String> primaryClip = selectedNodeRepository.getPrimarySelectedClip();
        if (primaryClip.isPresent()) {
            Optional<TimelineClip> clip = timelineManager.findClipById(primaryClip.get());
            uiTimelineManager.jumpAbsolute(clip.get().getInterval().getStartPosition().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 12 with Order

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

the class DefaultEditMenuItemConfiguration method addOutpointMenuItem.

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

Example 13 with Order

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

the class DefaultFileMenuItemConfiguration method exitContributionMenuItem.

@Bean
@Order(200)
public SelectableMenuContribution exitContributionMenuItem(ExitWithSaveService exitWithSaveService) {
    KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("quit", new KeyCodeCombination(KeyCode.Q, KeyCodeCombination.CONTROL_DOWN), "Exit").getCombination();
    return new DefaultMenuContribution(List.of(FILE_ROOT, "E_xit"), event -> {
        exitWithSaveService.optionallySaveAndThenRun(() -> {
            Platform.exit();
            System.exit(0);
        });
    }, 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 14 with Order

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

the class DefaultViewMenuItemConfiguration method fullScreenWindowContributionMenuItem.

@Bean
@Order(1800)
public SelectableMenuContribution fullScreenWindowContributionMenuItem(MessagingService messagingService) {
    return new DefaultMenuContribution(List.of(VIEW_ROOT, "Full screen"), e -> {
        stage.setFullScreen(true);
        stage.setFullScreenExitHint("Hit escape to exit fullscreen");
        stage.setFullScreenExitKeyCombination(new KeyCodeCombination(KeyCode.ESCAPE));
    });
}
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 15 with Order

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

the class DefaultWindowMenuItemConfiguration method saveLayoutMenuItem.

@Bean
@Order(3997)
public SelectableMenuContribution saveLayoutMenuItem(MessagingService messagingService, QuerySaveFilenameService querySaveFilenameService, @Value("${tactview.homedirectory}") String homeDirectory, AlertDialogFactory alertDialogFactory) {
    return new DefaultMenuContribution(List.of(WINDOW_MENU_ITEM, "Save layout"), e -> {
        QuerySaveFileNameRequest request = QuerySaveFileNameRequest.builder().withInitialDirectory(homeDirectory).withTitle("Save layout file").build();
        Optional<String> optionalFileName = querySaveFilenameService.queryUserAboutFileName(request);
        if (optionalFileName.isPresent()) {
            try {
                String fileName = optionalFileName.get();
                if (!fileName.endsWith("." + TACTVIEW_LAYOUT_EXTENSION)) {
                    fileName += ("." + TACTVIEW_LAYOUT_EXTENSION);
                }
                DetachableTabPaneLoadModel data = dockableTabRepository.extractLoadModel();
                String result = objectMapper.writeValueAsString(data);
                try (FileOutputStream fos = new FileOutputStream(new File(fileName))) {
                    fos.write(result.getBytes(StandardCharsets.UTF_8));
                }
            } catch (Exception e1) {
                alertDialogFactory.showExceptionDialog("Unable to save layout", e1);
                LOGGER.error("Unable to save layout", e1);
            }
        }
    });
}
Also used : DefaultMenuContribution(com.helospark.tactview.ui.javafx.menu.DefaultMenuContribution) FileOutputStream(java.io.FileOutputStream) DetachableTabPaneLoadModel(com.helospark.tactview.ui.javafx.tiwulfx.com.panemu.tiwulfx.control.DetachableTabPaneLoadModel) File(java.io.File) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) QuerySaveFileNameRequest(com.helospark.tactview.ui.javafx.save.QuerySaveFilenameService.QuerySaveFileNameRequest) 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