diff --git a/src/Tools/tim_tool/src/gui/file_tab.rs b/src/Tools/tim_tool/src/gui/file_tab.rs index 4bf68e6f..2f5118fe 100644 --- a/src/Tools/tim_tool/src/gui/file_tab.rs +++ b/src/Tools/tim_tool/src/gui/file_tab.rs @@ -25,8 +25,11 @@ impl FileTab { self.update_palette(palette); let main_window = self.main_window.borrow(); + let image_size = image.size(); main_window.set_file_tab_image_data(image); + main_window.set_file_tab_image_width(image_size.width as i32); + main_window.set_file_tab_image_height(image_size.height as i32); if let Some(file_name) = file_name { main_window.set_file_tab_image_name(file_name.into()); } diff --git a/src/Tools/tim_tool/ui/app-window.slint b/src/Tools/tim_tool/ui/app-window.slint index 4e00ab32..fa4d9faa 100644 --- a/src/Tools/tim_tool/ui/app-window.slint +++ b/src/Tools/tim_tool/ui/app-window.slint @@ -15,6 +15,8 @@ export component MainWindow inherits Window { // Convert Image values in-out property file_tab-browse_path <=> file_tab.conv-image_path; in-out property file_tab-image_data <=> file_tab.conv-image_data; + in-out property file_tab-image_width <=> file_tab.conv-image_width; + in-out property file_tab-image_height <=> file_tab.conv-image_height; in-out property file_tab-palette_data <=> file_tab.conv-palette_data; in-out property file_tab-palette_width <=> file_tab.conv-palette_width; in-out property file_tab-palette_height <=> file_tab.conv-palette_height; diff --git a/src/Tools/tim_tool/ui/tab/file-tab.slint b/src/Tools/tim_tool/ui/tab/file-tab.slint index 958b7070..76562557 100644 --- a/src/Tools/tim_tool/ui/tab/file-tab.slint +++ b/src/Tools/tim_tool/ui/tab/file-tab.slint @@ -15,6 +15,8 @@ component ConvertImageWidget inherits Rectangle { in-out property image_path; in-out property image_name; in-out property image_data; + in-out property image-width; + in-out property image-height; in-out property palette_data; in-out property palette_width: 0; in-out property palette_height: 0; @@ -59,18 +61,32 @@ component ConvertImageWidget inherits Rectangle { padding: 4px; HorizontalLayout { alignment: center; - Rectangle { - width: 256px + 2*4px; // < Because of border - height: 256px + 2*4px; // < Because of border - background: #404040; - border-color: #808080; - border-width: 4px; - Image { - width: 256px; - height: 256px; - source: root.image_data; - image-fit: contain; - image-rendering: pixelated; + VerticalLayout { + Rectangle { + width: 256px + 2*4px; // < Because of border + height: 256px + 2*4px; // < Because of border + background: #404040; + border-color: #808080; + border-width: 4px; + Image { + width: 256px; + height: 256px; + source: root.image_data; + image-fit: contain; + image-rendering: pixelated; + } + } + VerticalLayout { + alignment: center; + Text { + text: "Width: " + root.image-width; + } + } + VerticalLayout { + alignment: center; + Text { + text: "Height: " + root.image-height; + } } } Rectangle { @@ -172,17 +188,17 @@ component ConvertImageWidget inherits Rectangle { } export component FileTab inherits Rectangle { - // TODO: Names are messed up here! in-out property conv-image_path; in-out property conv-image_name; in-out property conv-image_data; + in-out property conv-image_width; + in-out property conv-image_height; in-out property conv-palette_data; in-out property conv-palette_width; in-out property conv-palette_height; in-out property conv-palette_enable; in-out property conv-enable_view; - in-out property state; callback conv-image_update_palette_size(int, int); callback conv-image_browse_clicked; @@ -220,6 +236,8 @@ export component FileTab inherits Rectangle { if root.state == State.ConvertImage : ConvertImageWidget { image_path <=> root.conv-image_path; image_data <=> root.conv-image_data; + image-width <=> root.conv-image_width; + image-height <=> root.conv-image_height; palette_data <=> root.conv-palette_data; palette_width <=> root.conv-palette_width; palette_height <=> root.conv-palette_height;