Support changing palette size

This commit is contained in:
2025-03-04 21:38:08 +01:00
parent 3cdfe4a677
commit 4d62d79cbd
6 changed files with 137 additions and 56 deletions

View File

@@ -23,6 +23,7 @@ component ConvertImageWidget inherits Rectangle {
callback browse_clicked();
callback add_clicked();
callback update_palette_size(int, int);
background: #D0D0D0;
@@ -110,15 +111,25 @@ component ConvertImageWidget inherits Rectangle {
}
}
VerticalLayout {
LineEdit {
width: 40pt;
enabled: root.palette_visible;
text: root.palette_width;
palette_width_edit := LineEdit {
width: 40pt;
input-type: number;
enabled: root.palette_visible;
text: root.palette_width;
accepted(text) => {
update_palette_size(palette_width_edit.text.to-float(), palette_height_edit.text.to-float());
}
}
LineEdit {
width: 40pt;
enabled: root.palette_visible;
text: root.palette_height;
palette_height_edit := LineEdit {
width: 40pt;
input-type: number;
enabled: root.palette_visible;
text: root.palette_height;
accepted(text) => {
update_palette_size(palette_width_edit.text.to-float(), palette_height_edit.text.to-float());
}
}
}
}
@@ -161,19 +172,21 @@ component ConvertImageWidget inherits Rectangle {
}
export component FileTab inherits Rectangle {
in-out property <string> conv_image_path;
in-out property <string> conv_image_name;
in-out property <image> conv_image_data;
in-out property <image> conv_palette_data;
in-out property <int> conv_palette_width;
in-out property <int> conv_palette_height;
in-out property <bool> conv_palette_enable;
in-out property <bool> conv_enable_view;
// TODO: Names are messed up here!
in-out property <string> conv-image_path;
in-out property <string> conv-image_name;
in-out property <image> conv-image_data;
in-out property <image> conv-palette_data;
in-out property <int> conv-palette_width;
in-out property <int> conv-palette_height;
in-out property <bool> conv-palette_enable;
in-out property <bool> conv-enable_view;
in-out property <State> state;
callback conv_image_browse_clicked;
callback conv_image_add_clicked;
callback conv-image_update_palette_size(int, int);
callback conv-image_browse_clicked;
callback conv-image_add_clicked;
x: 0px;
y: 0px;
@@ -205,21 +218,25 @@ export component FileTab inherits Rectangle {
if root.state == State.Project : ProjectWidget {
}
if root.state == State.ConvertImage : ConvertImageWidget {
image_path <=> root.conv_image_path;
image_data <=> root.conv_image_data;
palette_data <=> root.conv_palette_data;
palette_width <=> root.conv_palette_width;
palette_height <=> root.conv_palette_height;
palette_visible <=> root.conv_palette_enable;
image_name <=> root.conv_image_name;
enable_view <=> root.conv_enable_view;
image_path <=> root.conv-image_path;
image_data <=> root.conv-image_data;
palette_data <=> root.conv-palette_data;
palette_width <=> root.conv-palette_width;
palette_height <=> root.conv-palette_height;
palette_visible <=> root.conv-palette_enable;
image_name <=> root.conv-image_name;
enable_view <=> root.conv-enable_view;
update_palette_size(width, height) => {
root.conv-image_update_palette_size(width, height);
}
browse_clicked => {
root.conv_image_browse_clicked();
root.conv-image_browse_clicked();
}
add_clicked => {
root.conv_image_add_clicked();
root.conv-image_add_clicked();
}
}
}