Feat: make some stuff optional for the CLAP/VST version
This commit is contained in:
@@ -35,13 +35,13 @@ required-features = ["desktop"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
block-renderer = ["dep:soft_ratatui", "dep:rustc-hash"]
|
||||
desktop = [
|
||||
"block-renderer",
|
||||
"cagire-forth/desktop",
|
||||
"dep:egui",
|
||||
"dep:eframe",
|
||||
"dep:egui_ratatui",
|
||||
"dep:soft_ratatui",
|
||||
"dep:rustc-hash",
|
||||
"dep:image",
|
||||
]
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ description = "Cagire as a CLAP/VST3 audio plugin"
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
||||
[dependencies]
|
||||
cagire = { path = "../.." }
|
||||
cagire = { path = "../..", features = ["block-renderer"] }
|
||||
cagire-forth = { path = "../../crates/forth" }
|
||||
cagire-project = { path = "../../crates/project" }
|
||||
cagire-ratatui = { path = "../../crates/ratatui" }
|
||||
|
||||
@@ -17,6 +17,7 @@ use soft_ratatui::embedded_graphics_unicodefonts::{
|
||||
};
|
||||
use soft_ratatui::{EmbeddedGraphics, SoftBackend};
|
||||
|
||||
use cagire::block_renderer::BlockCharBackend;
|
||||
use cagire::app::App;
|
||||
use cagire::engine::{AudioCommand, LinkState, SequencerSnapshot};
|
||||
use cagire::input::{handle_key, handle_mouse, InputContext};
|
||||
@@ -28,7 +29,7 @@ use crate::input_egui::{convert_egui_events, convert_egui_mouse};
|
||||
use crate::params::CagireParams;
|
||||
use crate::PluginBridge;
|
||||
|
||||
type TerminalType = Terminal<RataguiBackend<EmbeddedGraphics>>;
|
||||
type TerminalType = Terminal<RataguiBackend<BlockCharBackend>>;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
enum FontChoice {
|
||||
@@ -106,7 +107,22 @@ fn create_terminal(font: FontChoice) -> TerminalType {
|
||||
FontChoice::Size10x20 => (mono_10x20_atlas(), None, None),
|
||||
};
|
||||
|
||||
let soft = SoftBackend::<EmbeddedGraphics>::new(80, 24, regular, bold, italic);
|
||||
let eg = SoftBackend::<EmbeddedGraphics>::new(80, 24, regular, bold, italic);
|
||||
let soft = SoftBackend {
|
||||
buffer: eg.buffer,
|
||||
cursor: eg.cursor,
|
||||
cursor_pos: eg.cursor_pos,
|
||||
char_width: eg.char_width,
|
||||
char_height: eg.char_height,
|
||||
blink_counter: eg.blink_counter,
|
||||
blinking_fast: eg.blinking_fast,
|
||||
blinking_slow: eg.blinking_slow,
|
||||
rgb_pixmap: eg.rgb_pixmap,
|
||||
always_redraw_list: eg.always_redraw_list,
|
||||
raster_backend: BlockCharBackend {
|
||||
inner: eg.raster_backend,
|
||||
},
|
||||
};
|
||||
Terminal::new(RataguiBackend::new("cagire", soft)).expect("terminal")
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,9 @@ impl App {
|
||||
}
|
||||
|
||||
pub fn maybe_show_onboarding(&mut self) {
|
||||
if self.plugin_mode {
|
||||
return;
|
||||
}
|
||||
if self.ui.modal != Modal::None {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
mod block_renderer;
|
||||
|
||||
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU32, AtomicU64, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use block_renderer::BlockCharBackend;
|
||||
use cagire::block_renderer::BlockCharBackend;
|
||||
use clap::Parser;
|
||||
use doux::EngineMetrics;
|
||||
use eframe::NativeOptions;
|
||||
|
||||
@@ -15,5 +15,8 @@ pub mod theme;
|
||||
pub mod views;
|
||||
pub mod widgets;
|
||||
|
||||
#[cfg(feature = "block-renderer")]
|
||||
pub mod block_renderer;
|
||||
|
||||
#[cfg(feature = "desktop")]
|
||||
pub mod input_egui;
|
||||
|
||||
@@ -74,6 +74,7 @@ const STANDALONE_ONLY: &[OptionsFocus] = &[
|
||||
OptionsFocus::MidiInput1,
|
||||
OptionsFocus::MidiInput2,
|
||||
OptionsFocus::MidiInput3,
|
||||
OptionsFocus::ResetOnboarding,
|
||||
];
|
||||
|
||||
/// Section layout: header line, divider line, then option lines.
|
||||
|
||||
@@ -232,17 +232,19 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
|
||||
render_option_line("Input 3", &midi_in_3, focus == OptionsFocus::MidiInput3, &theme),
|
||||
]);
|
||||
}
|
||||
lines.push(Line::from(""));
|
||||
lines.extend([
|
||||
render_section_header("ONBOARDING", &theme),
|
||||
render_divider(content_width, &theme),
|
||||
render_option_line(
|
||||
"Reset guides",
|
||||
&onboarding_str,
|
||||
focus == OptionsFocus::ResetOnboarding,
|
||||
&theme,
|
||||
),
|
||||
]);
|
||||
if !app.plugin_mode {
|
||||
lines.push(Line::from(""));
|
||||
lines.extend([
|
||||
render_section_header("ONBOARDING", &theme),
|
||||
render_divider(content_width, &theme),
|
||||
render_option_line(
|
||||
"Reset guides",
|
||||
&onboarding_str,
|
||||
focus == OptionsFocus::ResetOnboarding,
|
||||
&theme,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
let total_lines = lines.len();
|
||||
let max_visible = padded.height as usize;
|
||||
|
||||
Reference in New Issue
Block a user