From f7ae70b901ed0e67e1a4edec533946ddaea3429d Mon Sep 17 00:00:00 2001 From: jaby Date: Sun, 2 Feb 2025 21:12:37 +0000 Subject: [PATCH] Remove standard elements --- src/Tools/tim_tool/ui/tab/main-tab.slint | 45 +++++++++++++++--------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/Tools/tim_tool/ui/tab/main-tab.slint b/src/Tools/tim_tool/ui/tab/main-tab.slint index ed9864b2..33367df1 100644 --- a/src/Tools/tim_tool/ui/tab/main-tab.slint +++ b/src/Tools/tim_tool/ui/tab/main-tab.slint @@ -1,7 +1,16 @@ import { VRAMArea } from "../vram-components.slint"; import { Button, ComboBox, GroupBox, StandardListView } from "std-widgets.slint"; +struct VRAMImage { + img: image, + x: int, + y: int, +} + export component MainTab inherits Rectangle { + in property <[StandardListViewItem]> vram_file_list: []; + in property <[VRAMImage]> vram_images: []; + width: group.width + group.x*2; height: group.height + group.y*2 + 32px; @@ -12,26 +21,26 @@ export component MainTab inherits Rectangle { VerticalLayout { background_rect := Rectangle { - width: background_image.width + 8px; - height: background_image.height + 8px; - border-width: 4px; + width: background_image.width + root.get_border_width()*2px; + height: background_image.height + root.get_border_width()*2px; + border-width: root.get_border_width()*1px; border-color: #404040; background: #A0A0A0; background_image := VRAMArea { - x: 4px; - y: 4px; + x: root.get_border_width()*1px; + y: root.get_border_width()*1px; img: @image-url("../../../../../examples/PoolBox/assets/AllTheJaby.png"); img_x: 0; img_y: 0; } - // Extend these from input some how - /*VRAMArea { - x: 4px; - y: 4px; - img: @image-url("../../../../examples/PoolBox/assets/IMG_6921.png"); - img_x: 80; - img_y: 80; - }*/ + + for vram_image[i] in root.vram_images: VRAMArea { + x: root.get_border_width()*1px; + y: root.get_border_width()*1px; + img: vram-image.img; + img_x: vram-image.x; + img_y: vram-image.y; + } } HorizontalLayout { padding: 4px; @@ -43,10 +52,8 @@ export component MainTab inherits Rectangle { StandardListView { width: background_image.width/2; height: 128px; - model: [ { text: "Blue"}, { text: "Red" }, { text: "Green" }, - { text: "Yellow" }, { text: "Black"}, { text: "White"}, - { text: "Magenta" }, { text: "Cyan" }, - ]; + + model: root.vram_file_list; } HorizontalLayout { padding: 4px; @@ -77,4 +84,8 @@ export component MainTab inherits Rectangle { } } } + + function get_border_width() -> int { + return 4; + } } \ No newline at end of file