Compare commits

...

7 Commits

9 changed files with 319 additions and 282 deletions

View File

@ -1,24 +1,34 @@
import { Theme } from "theme.slint";
import { Metrics, DarkPalette } from "theme.slint";
import { EditorBar } from "editor_bar.slint";
import { StatusBar } from "status_bar.slint";
import { ToolBar } from "tool_bar.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 {
title: @tr("FM Editor");
preferred-width: 1280px;
preferred-height: 720px;
VerticalLayout {
VerticalBox {
j-rounding: 0px;
j-padding: Metrics.padding-sm;
j-spacing: Metrics.spacing-sm;
background: DarkPalette.background[0];
EditorBar { }
HorizontalLayout {
HorizontalBox {
background: DarkPalette.background[0];
j-padding: 0px;
j-spacing: Metrics.spacing-sm;
ToolBar { }
ObjectToolPanel { }
Rectangle {
Text {
font-size: Theme.font-lg;
font-size: Metrics.font-lg;
text: "INSERT VIEWPORT HERE";
vertical-alignment: center;
horizontal-alignment: center;

View File

@ -1,18 +1,15 @@
import { Theme } from "theme.slint";
import { Metrics, DarkPalette } from "theme.slint";
import { HorizontalBox } from "widgets/layout.slint";
export component EditorBar inherits Rectangle {
height: Theme.size-xl;
border-color: black;
border-width: 1px;
export component EditorBar inherits HorizontalBox {
height: Metrics.size-xl;
j-spacing: Metrics.spacing-xl;
j-alignment: start;
HorizontalLayout {
alignment: start;
padding: Theme.padding-md;
spacing: Theme.padding-xl;
Text {
font-size: Theme.font-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
vertical-alignment: center;
text: "Damn look at all the options and shit here it's like Hammer 2!!";
}
}
}

View File

@ -1,155 +1,134 @@
import { Theme } from "theme.slint";
import { Metrics, DarkPalette } from "theme.slint";
import { Panel } from "widgets/panel.slint";
import { Box, HorizontalBox, VerticalBox } from "widgets/layout.slint";
export component ObjectToolPanel inherits Rectangle {
export component ObjectToolPanel inherits VerticalBox {
width: 280px;
border-color: black;
border-width: 1px;
VerticalLayout {
padding: Theme.padding-md;
spacing: Theme.spacing-md;
HorizontalLayout {
height: Theme.size-md;
Text {
font-size: Theme.font-lg;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-lg;
text: @tr("Object Tool");
vertical-alignment: center;
}
}
Panel {
j-alignment: start;
title: @tr("Favourites");
j-elevation: 2;
Panel {
title: "Group Name";
title-alignment: center;
content-padding: 0px;
content-spacing: 0px;
HorizontalLayout {
height: Theme.size-md;
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
j-spacing: 0px;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: "Object Name";
vertical-alignment: center;
}
}
HorizontalLayout {
height: Theme.size-md;
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: "Object Name";
vertical-alignment: center;
}
}
HorizontalLayout {
height: Theme.size-md;
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: "Object Name";
vertical-alignment: center;
}
}
}
Panel {
title: "Group Name";
title-alignment: center;
content-padding: 0px;
content-spacing: 0px;
HorizontalLayout {
height: Theme.size-md;
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
j-spacing: 0px;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: "Object Name";
vertical-alignment: center;
}
}
HorizontalLayout {
height: Theme.size-md;
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: "Object Name";
vertical-alignment: center;
}
}
HorizontalLayout {
height: Theme.size-md;
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: "Object Name";
vertical-alignment: center;
}
}
}
}
Panel {
title: @tr("Hierarchy");
HorizontalLayout {
spacing: Theme.spacing-md;
height: Theme.size-md;
j-elevation: 2;
vertical-stretch: 1;
HorizontalBox {
j-elevation: 2;
j-padding: 0px;
j-spacing: Metrics.spacing-md;
height: Metrics.size-md;
Text {
font-size: Theme.font-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
vertical-alignment: center;
text: @tr("Name:");
}
Rectangle {
border-color: black;
border-width: 1px;
border-radius: Theme.radius-md;
Box {
j-padding: 0px;
Text {
font-size: Theme.font-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
vertical-alignment: center;
horizontal-alignment: left;
horizontal-alignment: center;
text: "VicHutch (-514)";
}
}
Rectangle {
border-color: black;
border-width: 1px;
border-radius: Theme.radius-md;
Box {
width: Metrics.size-md;
j-elevation: 3;
width: Theme.size-md;
Rectangle { }
}
Rectangle {
border-color: black;
border-width: 1px;
border-radius: Theme.radius-md;
Box {
width: Metrics.size-md;
j-elevation: 3;
width: Theme.size-md;
Rectangle { }
}
}
Rectangle {
border-color: black;
border-width: 1px;
border-radius: Theme.radius-md;
clip: true;
Box {
Text {
font-size: Theme.font-lg;
color: DarkPalette.text[4];
font-size: Metrics.font-lg;
text: "INSERT TREE VIEW HERE";
vertical-alignment: center;
horizontal-alignment: center;
@ -157,4 +136,3 @@ export component ObjectToolPanel inherits Rectangle {
}
}
}
}

View File

@ -1,17 +1,15 @@
import { Theme } from "theme.slint";
import { Metrics, DarkPalette } from "theme.slint";
import { VerticalSeparator } from "widgets/separator.slint";
import { HorizontalBox } from "widgets/layout.slint";
export component StatusBar inherits HorizontalBox {
height: Metrics.size-lg;
j-spacing: Metrics.spacing-lg;
j-alignment: start;
export component StatusBar inherits Rectangle {
border-color: black;
border-width: 1px;
height: Theme.size-lg;
HorizontalLayout {
alignment: start;
padding-left: Theme.padding-lg;
padding-right: Theme.padding-lg;
spacing: Theme.padding-lg;
Text {
font-size: Theme.font-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
vertical-alignment: center;
text: "Last saved: 18:50";
}
@ -19,11 +17,11 @@ export component StatusBar inherits Rectangle {
VerticalSeparator { }
Text {
font-size: Theme.font-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
vertical-alignment: center;
text: "Saved by: Jayrude";
}
VerticalSeparator { }
}
}

View File

@ -1,26 +1,43 @@
export global Theme {
in-out property <length> padding-sm: 4px;
in-out property <length> padding-md: 8px;
in-out property <length> padding-lg: 16px;
in-out property <length> padding-xl: 24px;
in-out property <length> spacing-sm: 4px;
in-out property <length> spacing-md: 8px;
in-out property <length> spacing-lg: 16px;
in-out property <length> spacing-xl: 24px;
in-out property <length> size-sm: 16px;
in-out property <length> size-md: 24px;
in-out property <length> size-lg: 32px;
in-out property <length> size-xl: 48px;
in-out property <length> radius-sm: 4px;
in-out property <length> radius-md: 8px;
in-out property <length> radius-lg: 16px;
in-out property <length> radius-xl: 32px;
in-out property <length> font-sm: 10px;
in-out property <length> font-md: 12px;
in-out property <length> font-lg: 16px;
in-out property <length> font-xl: 24px;
export global DarkPalette {
out property <[brush]> text: [#78716c, #a8a29e, #d6d3d1, #e7e5e4, #fafaf9];
out property <[brush]> background: [#0c0a09, #1c1917, #292524, #44403c, #57534e];
out property <[brush]> primary: [#083344, #164e63, #155e75, #0e7490, #0891b2];
out property <[brush]> secondary: [#44403c, #57534e, #78716c, #a8a29e, #d6d3d1];
out property <[brush]> accent: [#4c1d95, #5b21b6, #6d28d9, #7c3aed, #8b5cf6];
}
export global LightPalette {
out property <[brush]> text: [#57534e, #44403c, #292524, #1c1917, #0c0a09];
out property <[brush]> background: [#fafaf9, #e7e5e4, #d6d3d1, #a8a29e, #78716c];
out property <[brush]> primary: [#06b6d4, #0891b2, #0e7490, #155e75, #164e63];
out property <[brush]> secondary: [#a8a29e, #78716c, #57534e, #44403c, #292524];
out property <[brush]> accent: [#8b5cf6, #7c3aed, #6d28d9, #5b21b6, #4c1d95];
}
export global Metrics {
out property <length> padding-sm: 4px;
out property <length> padding-md: 8px;
out property <length> padding-lg: 16px;
out property <length> padding-xl: 24px;
out property <length> spacing-sm: 4px;
out property <length> spacing-md: 8px;
out property <length> spacing-lg: 16px;
out property <length> spacing-xl: 24px;
out property <length> size-sm: 16px;
out property <length> size-md: 24px;
out property <length> size-lg: 32px;
out property <length> size-xl: 48px;
out property <length> radius-sm: 4px;
out property <length> radius-md: 8px;
out property <length> radius-lg: 16px;
out property <length> radius-xl: 32px;
out property <length> font-sm: 10px;
out property <length> font-md: 12px;
out property <length> font-lg: 16px;
out property <length> font-xl: 24px;
}

View File

@ -1,24 +1,17 @@
import { Theme } from "theme.slint";
import { Metrics, DarkPalette } from "theme.slint";
import { Button } from "std-widgets.slint";
import { HorizontalSeparator } from "widgets/separator.slint";
import { Box, VerticalBox } from "widgets/layout.slint";
component ToolBarItem inherits Rectangle {
width: Theme.size-lg;
height: Theme.size-lg;
border-color: black;
border-width: 1px;
border-radius: Theme.radius-md;
component ToolBarItem inherits Box {
width: Metrics.size-lg;
height: Metrics.size-lg;
j-elevation: 2;
}
export component ToolBar inherits Rectangle {
width: Theme.size-xl;
border-color: black;
border-width: 1px;
VerticalLayout {
alignment: start;
padding: Theme.padding-md;
spacing: Theme.padding-md;
export component ToolBar inherits VerticalBox {
width: Metrics.size-xl;
j-alignment: start;
Button {
checkable: true;
@ -54,4 +47,3 @@ export component ToolBar inherits Rectangle {
ToolBarItem { }
}
}

60
ui/widgets/layout.slint Normal file
View File

@ -0,0 +1,60 @@
import {Metrics, DarkPalette} from "../theme.slint";
struct BorderStyle {
border-width: length,
border-color: brush,
border-radius: length,
}
export component HorizontalBox inherits Rectangle {
// TODO: border, shadow
in property <int> j-elevation: 1;
in property <length> j-rounding: Metrics.radius-md;
in property <length> j-padding: Metrics.padding-md;
in property <length> j-spacing: Metrics.spacing-md;
in property <LayoutAlignment> j-alignment: stretch;
background: DarkPalette.background[j-elevation];
border-radius: j-rounding;
clip: true;
HorizontalLayout {
alignment: j-alignment;
padding: j-padding;
spacing: j-spacing;
@children
}
}
export component VerticalBox inherits Rectangle {
// TODO: border, shadow
in property <int> j-elevation: 1;
in property <length> j-rounding: Metrics.radius-md;
in property <length> j-padding: Metrics.padding-md;
in property <length> j-spacing: Metrics.spacing-md;
in property <LayoutAlignment> j-alignment: stretch;
background: DarkPalette.background[j-elevation];
border-radius: j-rounding;
clip: true;
VerticalLayout {
alignment: j-alignment;
padding: j-padding;
spacing: j-spacing;
@children
}
}
export component Box inherits Rectangle {
in property <int> j-elevation: 1;
in property <length> j-rounding: Metrics.radius-md;
in property <length> j-padding: Metrics.padding-md;
background: DarkPalette.background[j-elevation];
border-radius: j-rounding;
clip: true;
padding: j-padding;
@children
}

View File

@ -1,37 +1,18 @@
import { Theme } from "../theme.slint";
import { Metrics, DarkPalette } from "../theme.slint";
import { VerticalBox } from "layout.slint";
export component Panel inherits Rectangle {
export component Panel inherits VerticalBox {
in property <string> title: "Title";
in property <TextHorizontalAlignment> title-alignment: left;
in property <length> content-padding: Theme.padding-md;
in property <length> content-spacing: Theme.spacing-md;
border-color: black;
border-width: 1px;
border-radius: Theme.radius-md;
clip: true;
VerticalLayout {
Rectangle {
height: Theme.size-md;
border-color: black;
border-width: 1px;
HorizontalLayout {
padding-left: Theme.padding-md;
padding-right: Theme.padding-md;
Text {
font-size: Theme.font-md;
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: title;
vertical-alignment: center;
horizontal-alignment: title-alignment;
}
}
}
VerticalLayout {
padding: content-padding;
spacing: content-spacing;
@children
}
}
}

View File

@ -1,16 +1,20 @@
import {DarkPalette} from "../theme.slint";
export component VerticalSeparator {
width: 1px;
Path {
width: 1px;
stroke: black;
stroke: DarkPalette.background[0];
stroke-width: 1px;
commands: "M 0 0 L 0 1 Z";
}
}
export component HorizontalSeparator {
height: 1px;
Path {
height: 1px;
stroke: black;
stroke: DarkPalette.background[0];
stroke-width: 1px;
commands: "M 0 0 L 1 0 Z";
}