WIP: half broken
This commit is contained in:
23
src/app.rs
23
src/app.rs
@@ -15,8 +15,8 @@ use crate::page::Page;
|
||||
use crate::services::pattern_editor;
|
||||
use crate::settings::Settings;
|
||||
use crate::state::{
|
||||
AudioSettings, EditorContext, Focus, LiveKeyState, Metrics, Modal, PatternField, PatternsNav,
|
||||
PlaybackState, ProjectState, UiState,
|
||||
AudioSettings, EditorContext, Focus, LiveKeyState, Metrics, Modal, PanelState, PatternField,
|
||||
PatternsNav, PlaybackState, ProjectState, UiState,
|
||||
};
|
||||
use crate::views::doc_view;
|
||||
|
||||
@@ -43,6 +43,7 @@ pub struct App {
|
||||
pub copied_bank: Option<Bank>,
|
||||
|
||||
pub audio: AudioSettings,
|
||||
pub panel: PanelState,
|
||||
}
|
||||
|
||||
impl App {
|
||||
@@ -74,6 +75,7 @@ impl App {
|
||||
copied_bank: None,
|
||||
|
||||
audio: AudioSettings::default(),
|
||||
panel: PanelState::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,12 +86,14 @@ impl App {
|
||||
input_device: self.audio.config.input_device.clone(),
|
||||
channels: self.audio.config.channels,
|
||||
buffer_size: self.audio.config.buffer_size,
|
||||
max_voices: self.audio.config.max_voices,
|
||||
},
|
||||
display: crate::settings::DisplaySettings {
|
||||
fps: self.audio.config.refresh_rate.to_fps(),
|
||||
runtime_highlight: self.ui.runtime_highlight,
|
||||
show_scope: self.audio.config.show_scope,
|
||||
show_spectrum: self.audio.config.show_spectrum,
|
||||
show_completion: self.ui.show_completion,
|
||||
},
|
||||
link: crate::settings::LinkSettings {
|
||||
enabled: link.is_enabled(),
|
||||
@@ -233,12 +237,23 @@ impl App {
|
||||
} else {
|
||||
script.lines().map(String::from).collect()
|
||||
};
|
||||
self.editor_ctx.text = tui_textarea::TextArea::new(lines);
|
||||
self.editor_ctx.editor.set_content(lines);
|
||||
let candidates = model::WORDS
|
||||
.iter()
|
||||
.map(|w| cagire_ratatui::CompletionCandidate {
|
||||
name: w.name.to_string(),
|
||||
signature: w.stack.to_string(),
|
||||
description: w.desc.to_string(),
|
||||
example: w.example.to_string(),
|
||||
})
|
||||
.collect();
|
||||
self.editor_ctx.editor.set_candidates(candidates);
|
||||
self.editor_ctx.editor.set_completion_enabled(self.ui.show_completion);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn save_editor_to_step(&mut self) {
|
||||
let text = self.editor_ctx.text.lines().join("\n");
|
||||
let text = self.editor_ctx.editor.content();
|
||||
let (bank, pattern) = self.current_bank_pattern();
|
||||
let change = pattern_editor::set_step_script(
|
||||
&mut self.project_state.project,
|
||||
|
||||
Reference in New Issue
Block a user