Feat: saving screen during perfs

This commit is contained in:
2026-02-21 15:56:52 +01:00
parent 12b90bc99b
commit 79a4c3b6e2
17 changed files with 117 additions and 223 deletions

View File

@@ -8,7 +8,7 @@ use crate::app::App;
use crate::engine::LinkState;
use crate::midi;
use crate::state::OptionsFocus;
use crate::theme;
use crate::theme::{self, ThemeColors};
use crate::widgets::{render_scroll_indicators, IndicatorAlign};
pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
@@ -90,6 +90,12 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
focus == OptionsFocus::ShowPreview,
&theme,
),
render_option_line(
"Performance mode",
if app.ui.performance_mode { "On" } else { "Off" },
focus == OptionsFocus::PerformanceMode,
&theme,
),
];
if app.plugin_mode {
let zoom_str = format!("{:.0}%", app.ui.zoom_factor * 100.0);
@@ -246,6 +252,14 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
]);
}
// Insert description below focused option
let focus_vec_idx = focus.line_index(app.plugin_mode);
if let Some(desc) = option_description(focus) {
if focus_vec_idx < lines.len() {
lines.insert(focus_vec_idx + 1, render_description_line(desc, &theme));
}
}
let total_lines = lines.len();
let max_visible = padded.height as usize;
@@ -318,6 +332,42 @@ fn render_option_line(label: &str, value: &str, focused: bool, theme: &theme::Th
])
}
fn option_description(focus: OptionsFocus) -> Option<&'static str> {
match focus {
OptionsFocus::ColorScheme => Some("Color scheme for the entire interface"),
OptionsFocus::HueRotation => Some("Shift all theme colors by a hue angle"),
OptionsFocus::RefreshRate => Some("Lower values reduce CPU usage"),
OptionsFocus::RuntimeHighlight => Some("Highlight executed code spans during playback"),
OptionsFocus::ShowScope => Some("Oscilloscope on the engine page"),
OptionsFocus::ShowSpectrum => Some("Spectrum analyzer on the engine page"),
OptionsFocus::ShowCompletion => Some("Word completion popup in the editor"),
OptionsFocus::ShowPreview => Some("Step script preview on the sequencer grid"),
OptionsFocus::PerformanceMode => Some("Hide header and footer bars"),
OptionsFocus::Font => Some("Bitmap font for the plugin window"),
OptionsFocus::ZoomFactor => Some("Scale factor for the plugin window"),
OptionsFocus::WindowSize => Some("Default size for the plugin window"),
OptionsFocus::LinkEnabled => Some("Join an Ableton Link session on the local network"),
OptionsFocus::StartStopSync => Some("Sync transport start/stop with other Link peers"),
OptionsFocus::Quantum => Some("Number of beats per phase cycle"),
OptionsFocus::MidiOutput0 => Some("MIDI output device for channel group 1"),
OptionsFocus::MidiOutput1 => Some("MIDI output device for channel group 2"),
OptionsFocus::MidiOutput2 => Some("MIDI output device for channel group 3"),
OptionsFocus::MidiOutput3 => Some("MIDI output device for channel group 4"),
OptionsFocus::MidiInput0 => Some("MIDI input device for channel group 1"),
OptionsFocus::MidiInput1 => Some("MIDI input device for channel group 2"),
OptionsFocus::MidiInput2 => Some("MIDI input device for channel group 3"),
OptionsFocus::MidiInput3 => Some("MIDI input device for channel group 4"),
OptionsFocus::ResetOnboarding => Some("Re-enable all dismissed guide popups"),
}
}
fn render_description_line(desc: &str, theme: &ThemeColors) -> Line<'static> {
Line::from(Span::styled(
format!(" {desc}"),
Style::new().fg(theme.ui.text_dim),
))
}
fn render_readonly_line(label: &str, value: &str, value_style: Style, theme: &theme::ThemeColors) -> Line<'static> {
let label_style = Style::new().fg(theme.ui.text_muted);
let label_width = 20;