From 57a76bbe2781ff36cb4f5c2be30d16769f6c51bc Mon Sep 17 00:00:00 2001 From: jaby Date: Sun, 26 Jan 2025 22:46:41 +0000 Subject: [PATCH] More progress --- src/Tools/tim_tool/ui/app-window.slint | 78 ++++++--------------- src/Tools/tim_tool/ui/file-tab.slint | 3 + src/Tools/tim_tool/ui/main-tab.slint | 36 ++++++++++ src/Tools/tim_tool/ui/vram-components.slint | 40 +++++++++++ 4 files changed, 100 insertions(+), 57 deletions(-) create mode 100644 src/Tools/tim_tool/ui/file-tab.slint create mode 100644 src/Tools/tim_tool/ui/main-tab.slint create mode 100644 src/Tools/tim_tool/ui/vram-components.slint diff --git a/src/Tools/tim_tool/ui/app-window.slint b/src/Tools/tim_tool/ui/app-window.slint index 4e65623d..8e0d2547 100644 --- a/src/Tools/tim_tool/ui/app-window.slint +++ b/src/Tools/tim_tool/ui/app-window.slint @@ -1,62 +1,26 @@ -component VRAMSegment inherits Rectangle { - in property img; - in property clip_x; - in property clip_y; - - width: 64px; - height: 256px; - clip: true; - Image { - source: img; - x: -root.clip_x*1px; - y: -root.clip_y*1px; - } -} - -component VRAMArea inherits Rectangle { - in property img; - in property img_x; - in property img_y; - - width: (64*16+15)*1px; - height: (256*2+1)*1px; - - for idx in 32 : VRAMSegment { - x: root.get_x(idx)*(64px + 1px); - y: root.get_y(idx)*(256px + 1px); - - img: img; - clip_x: (root.get_x(idx)*64) - root.img_x; - clip_y: (root.get_y(idx)*256) - root.img_y; - } - - function get_x(idx: int) -> int { - return mod(idx, 16); - } - - function get_y(idx: int) -> int { - return floor(idx/16); - } -} +import { MainTab } from "./main-tab.slint"; +import { FileTab } from "./file-tab.slint"; +import { TabWidget } from "std-widgets.slint"; export component MainWindow inherits Window { - min-width: 1024px; - min-height: 640px; + min-width: vram_tab.width; + min-height: vram_tab.height; - VRAMArea { - x: 0px; - y: 0px; - img: @image-url("../../../../examples/PoolBox/assets/AllTheJaby.png"); - img_x: 0; - img_y: 0; - background: #0365f796; - } - VRAMArea { - x: 0px; - y: 0px; - img: @image-url("../../../../examples/PoolBox/assets/IMG_6921.png"); - img_x: 80; - img_y: 80; - background: #ff000076; + TabWidget { + current-index: 1; + file_tab := Tab { + title: "File Bah" + root.min-width/1px; + FileTab { + x: 0px; + y: 0px; + } + } + vram_tab := Tab { + title: "VRAM Layout"; + MainTab { + x: 0px; + y: 0px; + } + } } } \ No newline at end of file diff --git a/src/Tools/tim_tool/ui/file-tab.slint b/src/Tools/tim_tool/ui/file-tab.slint new file mode 100644 index 00000000..50f51cfa --- /dev/null +++ b/src/Tools/tim_tool/ui/file-tab.slint @@ -0,0 +1,3 @@ +export component FileTab inherits Rectangle { + +} \ No newline at end of file diff --git a/src/Tools/tim_tool/ui/main-tab.slint b/src/Tools/tim_tool/ui/main-tab.slint new file mode 100644 index 00000000..541aed68 --- /dev/null +++ b/src/Tools/tim_tool/ui/main-tab.slint @@ -0,0 +1,36 @@ +import { VRAMArea } from "./vram-components.slint"; +import { GroupBox } from "std-widgets.slint"; + +export component MainTab inherits Rectangle { + width: group.width; + height: group.height; + group := GroupBox { + title: "VRAM Layout"; + x: 4px; + y: 4px; + + VerticalLayout { + Rectangle { + width: background_image.width + 8px; + height: background_image.height + 8px; + border-width: 4px; + border-color: black; + background_image := VRAMArea { + x: 4px; + y: 4px; + 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; + } + } + } + } +} \ No newline at end of file diff --git a/src/Tools/tim_tool/ui/vram-components.slint b/src/Tools/tim_tool/ui/vram-components.slint new file mode 100644 index 00000000..216a91de --- /dev/null +++ b/src/Tools/tim_tool/ui/vram-components.slint @@ -0,0 +1,40 @@ +component VRAMSegment inherits Rectangle { + in property img; + in property clip_x; + in property clip_y; + + width: 64px; + height: 256px; + clip: true; + Image { + source: img; + x: -root.clip_x*1px; + y: -root.clip_y*1px; + } +} + +export component VRAMArea inherits Rectangle { + in property img; + in property img_x; + in property img_y; + + width: (64*16+15)*1px; + height: (256*2+1)*1px; + + for idx in 32 : VRAMSegment { + x: root.get_x(idx)*(64px + 1px); + y: root.get_y(idx)*(256px + 1px); + + img: img; + clip_x: (root.get_x(idx)*64) - root.img_x; + clip_y: (root.get_y(idx)*256) - root.img_y; + } + + function get_x(idx: int) -> int { + return mod(idx, 16); + } + + function get_y(idx: int) -> int { + return floor(idx/16); + } +} \ No newline at end of file