Compare commits

..

No commits in common. "e5472b867c89952f845c134cbf4873aad48a1ebc" and "35966bc8e3c1af07d6a01983f2784abce3c16e24" have entirely different histories.

7 changed files with 74 additions and 80 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, ToolType } from "tool_bar.slint"; import { ToolBar } 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;
p-elevation: 0; background: DarkPalette.background[0];
EditorBar { } EditorBar { }
HorizontalBox { HorizontalBox {
p-elevation: 0; background: DarkPalette.background[0];
p-padding: 0px; p-padding: 0px;
p-spacing: Metrics.spacing-sm; p-spacing: Metrics.spacing-sm;
c-toolbar := ToolBar { } ToolBar { }
if (c-toolbar.p-current-tool == ToolType.Object): ObjectToolPanel { } 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/components.slint"; import { HorizontalBox } from "widgets/layout.slint";
export component EditorBar inherits HorizontalBox { export component EditorBar inherits HorizontalBox {
height: Metrics.size-xl; height: Metrics.size-xl;

View File

@ -1,5 +1,7 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { Box, HorizontalBox, VerticalBox, Panel } from "widgets/components.slint"; import { Panel } from "widgets/panel.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,5 +1,6 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { HorizontalBox, VerticalSeparator } from "widgets/components.slint"; import { VerticalSeparator } from "widgets/separator.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,21 +1,7 @@
import { Metrics, DarkPalette } from "theme.slint"; import { Metrics, DarkPalette } from "theme.slint";
import { Box, Button, HorizontalSeparator, VerticalBox } from "widgets/components.slint"; import { HorizontalSeparator } from "widgets/separator.slint";
import { Box, VerticalBox } from "widgets/layout.slint";
export enum ToolType { import { Button } from "widgets/button.slint";
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;
@ -27,50 +13,59 @@ export component ToolBar inherits VerticalBox {
width: Metrics.size-xl; width: Metrics.size-xl;
p-alignment: start; p-alignment: start;
out property <ToolType> p-current-tool: ToolType.Select; ToolBarItem {
p-text: "s";
}
private property <[{text: string, type: ToolType}]> p-transform-tools: [ ToolBarItem {
{ text: "s", type: ToolType.Select }, p-text: "m";
{ 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 },
];
for item[index] in root.p-transform-tools: ToolBarItem { ToolBarItem {
p-text: item.text; p-text: "r";
a-clicked => { }
root.p-current-tool = item.type;
} ToolBarItem {
p-text: "s";
} }
HorizontalSeparator { } HorizontalSeparator { }
for item[index] in root.p-brush-tools: ToolBarItem { ToolBarItem {
p-text: item.text; p-text: "b";
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 { }
for item[index] in root.p-other-tools: ToolBarItem { ToolBarItem {
p-text: item.text; p-text: "t";
a-clicked => { }
root.p-current-tool = item.type;
} ToolBarItem {
p-text: "t";
}
ToolBarItem {
p-text: "m";
} }
} }

View File

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