ansi.rs - icy_draw - icy_draw is the successor to mystic draw. fork / mirror
(HTM) git clone https://git.drkhsh.at/icy_draw.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
ansi.rs (3515B)
---
1 use eframe::egui::{self, Ui};
2 use egui::Checkbox;
3 use i18n_embed_fl::fl;
4 use icy_engine::{SaveOptions, ScreenPreperation};
5
6 pub fn create_settings_page(ui: &mut Ui, options: &mut SaveOptions) {
7 ui.vertical(|ui| {
8 ui.horizontal(|ui| {
9 ui.label(fl!(crate::LANGUAGE_LOADER, "export-video-preparation-label"));
10
11 let label = match options.screen_preparation {
12 ScreenPreperation::None => {
13 fl!(crate::LANGUAGE_LOADER, "export-video-preparation-None")
14 }
15 ScreenPreperation::ClearScreen => {
16 fl!(crate::LANGUAGE_LOADER, "export-video-preparation-Clear")
17 }
18 ScreenPreperation::Home => {
19 fl!(crate::LANGUAGE_LOADER, "export-video-preparation-Home")
20 }
21 };
22
23 egui::ComboBox::from_id_source("screen_prep_combo")
24 .selected_text(label)
25 .width(150.)
26 .show_ui(ui, |ui| {
27 ui.selectable_value(
28 &mut options.screen_preparation,
29 ScreenPreperation::None,
30 fl!(crate::LANGUAGE_LOADER, "export-video-preparation-None"),
31 );
32 ui.selectable_value(
33 &mut options.screen_preparation,
34 ScreenPreperation::ClearScreen,
35 fl!(crate::LANGUAGE_LOADER, "export-video-preparation-Clear"),
36 );
37 ui.selectable_value(
38 &mut options.screen_preparation,
39 ScreenPreperation::Home,
40 fl!(crate::LANGUAGE_LOADER, "export-video-preparation-Home"),
41 );
42 });
43 });
44 ui.checkbox(&mut options.compress, fl!(crate::LANGUAGE_LOADER, "export-compression-label"));
45
46 ui.add_enabled(
47 options.compress,
48 Checkbox::new(&mut options.use_repeat_sequences, fl!(crate::LANGUAGE_LOADER, "export-use_repeat_sequences")),
49 );
50
51 ui.checkbox(&mut options.preserve_line_length, fl!(crate::LANGUAGE_LOADER, "export-save_full_line_length"));
52
53 ui.horizontal(|ui| {
54 ui.add(egui::Checkbox::new(
55 &mut options.modern_terminal_output,
56 fl!(crate::LANGUAGE_LOADER, "export-utf8-output-label"),
57 ));
58 });
59
60 ui.horizontal(|ui| {
61 let mut use_max_lines = options.output_line_length.is_some();
62 ui.add(egui::Checkbox::new(
63 &mut use_max_lines,
64 fl!(crate::LANGUAGE_LOADER, "export-limit-output-line-length-label"),
65 ));
66 if use_max_lines != options.output_line_length.is_some() {
67 if use_max_lines {
68 options.output_line_length = Some(80);
69 } else {
70 options.output_line_length = None;
71 }
72 }
73 if let Some(mut len) = options.output_line_length {
74 ui.add(egui::Slider::new(&mut len, 32..=255).text(fl!(crate::LANGUAGE_LOADER, "export-maximum_line_length")));
75 options.output_line_length = Some(len);
76 }
77 });
78
79 ui.horizontal(|ui: &mut Ui| {
80 ui.add(egui::Checkbox::new(
81 &mut options.save_sauce,
82 fl!(crate::LANGUAGE_LOADER, "export-save-sauce-label"),
83 ));
84 });
85 });
86 }