Compare commits

...

5 Commits

7 changed files with 80 additions and 74 deletions

View File

@ -1,10 +1,10 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { VerticalBox, HorizontalBox } from "widgets/components.slint";
import { EditorBar } from "editor_bar.slint"; import { EditorBar } from "editor_bar.slint";
import { StatusBar } from "status_bar.slint"; import { StatusBar } from "status_bar.slint";
import { ToolBar } from "tool_bar.slint"; import { ToolBar, ToolType } from "tool_bar.slint";
import { ObjectToolPanel } from "object_tool_panel.slint"; import { ObjectToolPanel } from "object_tool_panel.slint";
import { VerticalBox, HorizontalBox } from "widgets/layout.slint";
import { VerticalSeparator } from "widgets/separator.slint";
export component AppWindow inherits Window { export component AppWindow inherits Window {
title: @tr("FM Editor"); title: @tr("FM Editor");
@ -14,17 +14,17 @@ export component AppWindow inherits Window {
p-rounding: 0px; p-rounding: 0px;
p-padding: Metrics.padding-sm; p-padding: Metrics.padding-sm;
p-spacing: Metrics.spacing-sm; p-spacing: Metrics.spacing-sm;
background: DarkPalette.background[0]; p-elevation: 0;
EditorBar { } EditorBar { }
HorizontalBox { HorizontalBox {
background: DarkPalette.background[0]; p-elevation: 0;
p-padding: 0px; p-padding: 0px;
p-spacing: Metrics.spacing-sm; p-spacing: Metrics.spacing-sm;
ToolBar { } c-toolbar := ToolBar { }
ObjectToolPanel { } if (c-toolbar.p-current-tool == ToolType.Object): ObjectToolPanel { }
Rectangle { Rectangle {
Text { Text {

View File

@ -1,5 +1,5 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { HorizontalBox } from "widgets/layout.slint"; import { HorizontalBox } from "widgets/components.slint";
export component EditorBar inherits HorizontalBox { export component EditorBar inherits HorizontalBox {
height: Metrics.size-xl; height: Metrics.size-xl;

View File

@ -1,7 +1,5 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { Panel } from "widgets/panel.slint"; import { Box, HorizontalBox, VerticalBox, Panel } from "widgets/components.slint";
import { Box, HorizontalBox, VerticalBox } from "widgets/layout.slint";
export component ObjectToolPanel inherits VerticalBox { export component ObjectToolPanel inherits VerticalBox {
width: 280px; width: 280px;

View File

@ -1,6 +1,5 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { VerticalSeparator } from "widgets/separator.slint"; import { HorizontalBox, VerticalSeparator } from "widgets/components.slint";
import { HorizontalBox } from "widgets/layout.slint";
export component StatusBar inherits HorizontalBox { export component StatusBar inherits HorizontalBox {
height: Metrics.size-lg; height: Metrics.size-lg;

View File

@ -1,7 +1,21 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { HorizontalSeparator } from "widgets/separator.slint"; import { Box, Button, HorizontalSeparator, VerticalBox } from "widgets/components.slint";
import { Box, VerticalBox } from "widgets/layout.slint";
import { Button } from "widgets/button.slint"; export enum ToolType {
Select,
Move,
Rotate,
Scale,
Brush,
Light,
Area,
Object,
Flow,
Room,
Texture,
Timeline,
Multibrush,
}
component ToolBarItem inherits Button { component ToolBarItem inherits Button {
width: Metrics.size-lg; width: Metrics.size-lg;
@ -13,59 +27,50 @@ export component ToolBar inherits VerticalBox {
width: Metrics.size-xl; width: Metrics.size-xl;
p-alignment: start; p-alignment: start;
ToolBarItem { out property <ToolType> p-current-tool: ToolType.Select;
p-text: "s";
}
ToolBarItem { private property <[{text: string, type: ToolType}]> p-transform-tools: [
p-text: "m"; { text: "s", type: ToolType.Select },
} { text: "m", type: ToolType.Move },
{ text: "r", type: ToolType.Rotate },
{ text: "s", type: ToolType.Scale },
];
private property <[{text: string, type: ToolType}]> p-brush-tools: [
{ text: "b", type: ToolType.Brush },
{ text: "o", type: ToolType.Object },
{ text: "f", type: ToolType.Flow },
{ text: "r", type: ToolType.Room },
{ text: "l", type: ToolType.Light },
{ text: "a", type: ToolType.Area },
];
private property <[{text: string, type: ToolType}]> p-other-tools: [
{ text: "t", type: ToolType.Texture },
{ text: "t", type: ToolType.Timeline },
{ text: "m", type: ToolType.Multibrush },
];
ToolBarItem { for item[index] in root.p-transform-tools: ToolBarItem {
p-text: "r"; p-text: item.text;
} a-clicked => {
root.p-current-tool = item.type;
ToolBarItem { }
p-text: "s";
} }
HorizontalSeparator { } HorizontalSeparator { }
ToolBarItem { for item[index] in root.p-brush-tools: ToolBarItem {
p-text: "b"; p-text: item.text;
} a-clicked => {
root.p-current-tool = item.type;
ToolBarItem { }
p-text: "o";
}
ToolBarItem {
p-text: "f";
}
ToolBarItem {
p-text: "r";
}
ToolBarItem {
p-text: "l";
}
ToolBarItem {
p-text: "a";
} }
HorizontalSeparator { } HorizontalSeparator { }
ToolBarItem { for item[index] in root.p-other-tools: ToolBarItem {
p-text: "t"; p-text: item.text;
} a-clicked => {
root.p-current-tool = item.type;
ToolBarItem { }
p-text: "t";
}
ToolBarItem {
p-text: "m";
} }
} }

View File

@ -0,0 +1,6 @@
import { Button } from "button.slint";
import { VerticalBox, HorizontalBox, Box } from "layout.slint";
import { Panel } from "panel.slint";
import { VerticalSeparator, HorizontalSeparator } from "separator.slint";
export { Button, VerticalBox, HorizontalBox, Box, Panel, VerticalSeparator, HorizontalSeparator }

View File

@ -1,21 +1,19 @@
import {DarkPalette} from "../theme.slint"; import {DarkPalette} from "../theme.slint";
export component VerticalSeparator { export component VerticalSeparator inherits Path {
in property <int> p-elevation: 0;
width: 1px; width: 1px;
Path { stroke: DarkPalette.background[root.p-elevation];
width: 1px; stroke-width: 1px;
stroke: DarkPalette.background[0]; commands: "M 0 0 L 0 1 Z";
stroke-width: 1px;
commands: "M 0 0 L 0 1 Z";
}
} }
export component HorizontalSeparator { export component HorizontalSeparator inherits Path {
in property <int> p-elevation: 0;
height: 1px; height: 1px;
Path { stroke: DarkPalette.background[root.p-elevation];
height: 1px; stroke-width: 1px;
stroke: DarkPalette.background[0]; commands: "M 0 0 L 1 0 Z";
stroke-width: 1px;
commands: "M 0 0 L 1 0 Z";
}
} }