Add GUI for palette width/height

This commit is contained in:
Jaby 2025-03-04 20:40:50 +01:00
parent 1f8fc5100c
commit e948887faa
2 changed files with 47 additions and 18 deletions

View File

@ -18,7 +18,7 @@ export component MainWindow inherits Window {
in-out property file_tab_palette_data <=> file_tab.conv_palette_data;
in-out property file_tab_palette_visible <=> file_tab.conv_palette_enable;
in-out property file_tab_image_name <=> file_tab.conv_image_name;
in-out property file_tab_enable <=> file_tab.conv_image_enable;
in-out property file_tab_enable <=> file_tab.conv_enable_view;
callback file_tab_browse_convert_image <=> file_tab.conv_image_browse_clicked;
callback file_tab_add_convert_image <=> file_tab.conv_image_add_clicked;

View File

@ -16,7 +16,7 @@ component ConvertImageWidget inherits Rectangle {
in-out property <image> image_data;
in-out property <image> palette_data;
in-out property <string> image_name;
in-out property <bool> enable_button: false;
in-out property <bool> enable_view: false;
in-out property <bool> palette_visible: false;
callback browse_clicked();
@ -75,19 +75,48 @@ component ConvertImageWidget inherits Rectangle {
width: 4px;
height: 1px;
}
Rectangle {
width: 256px + 2*4px; // < Because of border
height: 256px + 2*4px; // < Because of border
background: #404040;
border-color: #808080;
border-width: 4px;
palette_image := Image {
width: 256px;
height: 256px;
source: root.palette_data;
visible: root.palette_visible;
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;
palette_image := Image {
width: 256px;
height: 256px;
source: root.palette_data;
visible: root.palette_visible;
image-fit: contain;
image-rendering: pixelated;
}
}
HorizontalLayout {
alignment: start;
VerticalLayout {
VerticalLayout {
alignment: center;
Text {
text: "Width: ";
}
}
VerticalLayout {
alignment: center;
Text {
text: "Height: ";
}
}
}
VerticalLayout {
LineEdit {
width: 40pt;
enabled: root.enable_view;
}
LineEdit {
width: 40pt;
enabled: root.enable_view;
}
}
}
}
}
@ -109,7 +138,7 @@ component ConvertImageWidget inherits Rectangle {
padding: 4px;
Button {
text: "Add Image";
enabled: root.enable_button;
enabled: root.enable_view;
clicked => {root.add_clicked();}
}
}
@ -133,7 +162,7 @@ export component FileTab inherits Rectangle {
in-out property <image> conv_palette_data;
in-out property <bool> conv_palette_enable;
in-out property <string> conv_image_name;
in-out property <bool> conv_image_enable;
in-out property <bool> conv_enable_view;
in-out property <State> state;
callback conv_image_browse_clicked;
callback conv_image_add_clicked;
@ -173,7 +202,7 @@ export component FileTab inherits Rectangle {
palette_data <=> root.conv_palette_data;
palette_visible <=> root.conv_palette_enable;
image_name <=> root.conv_image_name;
enable_button <=> root.conv_image_enable;
enable_view <=> root.conv_enable_view;
browse_clicked => {
root.conv_image_browse_clicked();