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