Added storage for settings

This commit is contained in:
Jaby 2025-04-05 23:36:58 +02:00 committed by cody
parent 9501954587
commit 4942012da1
2 changed files with 29 additions and 11 deletions

View File

@ -94,6 +94,8 @@ impl MainTab {
x: vram_image.x as i32, x: vram_image.x as i32,
y: vram_image.y as i32, y: vram_image.y as i32,
encoding_str: SharedString::from(encoding_str), encoding_str: SharedString::from(encoding_str),
use_compression: false,
trans_setting: 0,
palette_count, palette_count,
is_palette, is_palette,
} }

View File

@ -10,6 +10,8 @@ struct VRAMInfo {
x: int, x: int,
y: int, y: int,
encoding_str: string, encoding_str: string,
use_compression: bool,
trans_setting: int,
palette_count: int, palette_count: int,
is_palette: bool, // < Can we combine the palette into this, instead of having it separate? is_palette: bool, // < Can we combine the palette into this, instead of having it separate?
} }
@ -315,6 +317,12 @@ export component MainTab inherits Rectangle {
lz4_check_box := CheckBox { lz4_check_box := CheckBox {
text: "Compress (lz4)"; text: "Compress (lz4)";
enabled: file_settings_box.enabled; enabled: file_settings_box.enabled;
toggled => {
if(vram_files_list.current-item != -1) {
root.vram_data[vram_files_list.current-item].info.use_compression = self.checked;
}
}
} }
GroupBox { GroupBox {
@ -325,12 +333,20 @@ export component MainTab inherits Rectangle {
trans_combo_box := ComboBox { trans_combo_box := ComboBox {
model: ["No transparency", "First color transparent", "PSX semi-transparency", "Both"]; model: ["No transparency", "First color transparent", "PSX semi-transparency", "Both"];
enabled: file_settings_box.enabled; enabled: file_settings_box.enabled;
selected(current-value) => {
if(vram_files_list.current-item != -1) {
root.vram_data[vram_files_list.current-item].info.trans_setting = self.current-index;
}
}
} }
} }
} }
} }
public function set_active(item: int) { public function set_active(current-item: int) {
lz4_check_box.checked = root.vram_data[current-item].info.use_compression;
trans_combo_box.current-index = root.vram_data[current-item].info.trans_setting;
self.enabled = true; self.enabled = true;
} }