Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7e10d0e
basic layout choice menu
Kr0nox Jan 5, 2025
8519178
Merge remote-tracking branch 'origin/main' into layout-options
Kr0nox Jan 31, 2025
3d31eb2
move theme switch
Kr0nox Jan 31, 2025
f7ffb31
switch layout on dropdown change
Kr0nox Jan 31, 2025
9a4650a
better edge layouting
Kr0nox Feb 1, 2025
ce4658f
port allignment of circle layout
Kr0nox Feb 1, 2025
5727137
scale to screen after layout
Kr0nox Feb 2, 2025
dcd6125
hide edge labels
Kr0nox Feb 4, 2025
c3aed26
fix edge case
Kr0nox Feb 4, 2025
0d47cf0
move to commands
Kr0nox Feb 5, 2025
a1929ad
fix build
Kr0nox Feb 5, 2025
47976d8
fix layouting
Kr0nox Feb 5, 2025
5611893
Merge remote-tracking branch 'origin/main' into layout-options
Kr0nox Feb 5, 2025
5bf41c0
fix port movement after name simplification
Kr0nox Mar 4, 2025
345cf77
Merge remote-tracking branch 'origin/main' into layout-options
Kr0nox Mar 4, 2025
df2a85e
fix build
Kr0nox Mar 4, 2025
aba0e82
hide labels and change min size
Kr0nox Mar 4, 2025
8db4b76
read only button
Kr0nox Mar 6, 2025
0d2d68e
Merge branch 'layout-options' of https://github.com/DataFlowAnalysis/…
Kr0nox Mar 6, 2025
1015918
fix switch edge cases
Kr0nox Mar 6, 2025
d282d3b
remove unused variables
Kr0nox Mar 6, 2025
6b84cc2
reset simplification when disabeling readonly
Kr0nox Mar 8, 2025
18b5430
move to only two modes
Kr0nox Mar 12, 2025
3f6dc88
remove duplicate command
Kr0nox Mar 12, 2025
a43f635
rename mode in json
Kr0nox Mar 12, 2025
faf539f
rename mode in json everywhere
Kr0nox Mar 12, 2025
24c01e3
enable moving and layout in read only
Kr0nox Mar 12, 2025
e9b1993
fix build
Kr0nox Mar 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,11 @@ This editor currently has three different modes:
- `edit`: The default mode, allows to view and edit the diagram. Creation of new elements is possible.
Existing elements can be moved, modified, and deleted.
Newly created diagrams are always in this mode.
- `annotated`: In this mode the diagram is read-only. The node annotations (refer to the DFD elements module)
- `view`: In this mode the diagram is read-only. The node annotations (refer to the DFD elements module)
are displayed and can be viewed to get information about e.g. analysis validation errors.
The user can still zoom and pan the diagram. Creation, deletion, and modification of elements is not possible.
However the user can click a button to switch to the `edit` mode.
Doing so will remove all node annotations and allow the user to edit the diagram again.
- `readonly`: This mode is similar to the `annotated` mode but does not allow switching back to the `edit` mode.
It is intended to be used when the diagram is from a generated source and should only be viewed.

Diagrams with modes other than `edit` are not creatable using the editor.
Diagrams with these modes are intended to be generated from some other source.
Expand All @@ -249,7 +247,7 @@ This module contains the `EditorModeController` which manages the global editor
All other modules that want to behave differently depending on the editor mode use this as a
source of truth and subscribe to changes of the editor mode.
Additionally, this module contains a UI that shows when the editor mode is not `edit`
and allows switching from `annotated` to `edit` mode.
and allows switching from `view` to `edit` mode.

### (DFD) Label

Expand Down
7 changes: 5 additions & 2 deletions src/common/commandPalette.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { injectable } from "inversify";
import { inject, injectable } from "inversify";
import { ICommandPaletteActionProvider, LabeledAction, SModelRootImpl, CommitModelAction } from "sprotty";
import { Point } from "sprotty-protocol";
import { LoadDiagramAction } from "../features/serialize/load";
Expand All @@ -13,12 +13,15 @@ import "./commandPalette.css";
import { SaveDFDandDDAction } from "../features/serialize/saveDFDandDD";
import { LoadDFDandDDAction } from "../features/serialize/loadDFDandDD";
import { LoadPalladioAction } from "../features/serialize/loadPalladio";
import { SettingsManager } from "../features/settingsMenu/SettingsManager";

/**
* Provides possible actions for the command palette.
*/
@injectable()
export class ServerCommandPaletteActionProvider implements ICommandPaletteActionProvider {
constructor(@inject(SettingsManager) protected readonly settings: SettingsManager) {}

async getActions(
root: Readonly<SModelRootImpl>,
_text: string,
Expand All @@ -37,7 +40,7 @@ export class ServerCommandPaletteActionProvider implements ICommandPaletteAction
new LabeledAction("Load default diagram", [LoadDefaultDiagramAction.create(), commitAction], "clear-all"),
new LabeledAction("Fit to Screen", [fitToScreenAction], "layout"),
new LabeledAction(
"Layout diagram",
"Layout diagram (Method: " + this.settings.layoutMethod + ")",
[LayoutModelAction.create(), commitAction, fitToScreenAction],
"layout",
),
Expand Down
5 changes: 0 additions & 5 deletions src/common/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { FitToScreenKeyListener as CenterDiagramKeyListener } from "./fitToScree
import { DiagramModificationCommandStack } from "./customCommandStack";

import "./commonStyling.css";
import { LightDarkSwitch } from "./lightDarkSwitch";

export const commonModule = new ContainerModule((bind, unbind, isBound, rebind) => {
bind(ServerCommandPaletteActionProvider).toSelf().inSingletonScope();
Expand All @@ -34,10 +33,6 @@ export const commonModule = new ContainerModule((bind, unbind, isBound, rebind)
bind(TYPES.IUIExtension).toService(HelpUI);
bind(EDITOR_TYPES.DefaultUIElement).toService(HelpUI);

bind(LightDarkSwitch).toSelf().inSingletonScope();
bind(TYPES.IUIExtension).toService(LightDarkSwitch);
bind(EDITOR_TYPES.DefaultUIElement).toService(LightDarkSwitch);

bind(DynamicChildrenProcessor).toSelf().inSingletonScope();

unbind(TYPES.ICommandStack);
Expand Down
20 changes: 0 additions & 20 deletions src/common/lightDarkSwitch.css

This file was deleted.

56 changes: 0 additions & 56 deletions src/common/lightDarkSwitch.ts

This file was deleted.

12 changes: 1 addition & 11 deletions src/features/autoLayout/command.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { inject, optional } from "inversify";
import { inject } from "inversify";
import { Command, CommandExecutionContext, SModelRootImpl, TYPES } from "sprotty";
import { Action, IModelLayoutEngine, SGraph, SModelRoot } from "sprotty-protocol";
import { LoadDiagramCommand } from "../serialize/load";
import { EditorModeController } from "../editorMode/editorModeController";

export interface LayoutModelAction extends Action {
kind: typeof LayoutModelAction.KIND;
Expand All @@ -20,22 +19,13 @@ export namespace LayoutModelAction {
export class LayoutModelCommand extends Command {
static readonly KIND = LayoutModelAction.KIND;

@inject(EditorModeController)
@optional()
private editorModeController?: EditorModeController;

@inject(TYPES.IModelLayoutEngine)
private readonly layoutEngine?: IModelLayoutEngine;

private oldModelSchema?: SModelRoot;
private newModel?: SModelRootImpl;

async execute(context: CommandExecutionContext): Promise<SModelRootImpl> {
if (this.editorModeController?.isReadOnly()) {
// We don't want to layout the model in read-only mode.
return context.root;
}

this.oldModelSchema = context.modelFactory.createSchema(context.root);

if (!this.layoutEngine) throw new Error("Missing injects");
Expand Down
5 changes: 3 additions & 2 deletions src/features/autoLayout/di.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { ContainerModule } from "inversify";
import { TYPES, configureCommand } from "sprotty";
import { ElkFactory, ILayoutConfigurator } from "sprotty-elk";
import { ElkFactory, ILayoutConfigurator, ILayoutPostprocessor } from "sprotty-elk";
import { LayoutModelCommand } from "./command";
import { DfdElkLayoutEngine, DfdLayoutConfigurator, elkFactory } from "./layouter";
import { CircleLayoutPostProcessor, DfdElkLayoutEngine, DfdLayoutConfigurator, elkFactory } from "./layouter";
import { AutoLayoutKeyListener } from "./keyListener";

export const autoLayoutModule = new ContainerModule((bind, unbind, isBound, rebind) => {
bind(DfdElkLayoutEngine).toSelf().inSingletonScope();
bind(TYPES.IModelLayoutEngine).toService(DfdElkLayoutEngine);
rebind(ILayoutConfigurator).to(DfdLayoutConfigurator);
bind(ILayoutPostprocessor).to(CircleLayoutPostProcessor).inSingletonScope();
bind(ElkFactory).toConstantValue(elkFactory);
bind(TYPES.KeyListener).to(AutoLayoutKeyListener).inSingletonScope();

Expand Down
Loading