update egui and egui_baseview
This commit is contained in:
parent
7a01b57735
commit
0dccb4501f
115
Cargo.lock
generated
115
Cargo.lock
generated
|
@ -1020,10 +1020,22 @@ dependencies = [
|
|||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"smithay-clipboard",
|
||||
"x11-clipboard 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "copypasta"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d35364349bf9e9e1c3a035ddcb00d188d23a3c40c50244c03c27a99fc6a65ae"
|
||||
dependencies = [
|
||||
"clipboard-win",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"x11-clipboard 0.8.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.4"
|
||||
|
@ -1446,18 +1458,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.22.0"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e479a7fa3f23d4e794f8b2f8b3568dd4e47886ad1b12c9c095e141cb591eb63"
|
||||
checksum = "03cfe80b1890e1a8cdbffc6044d6872e814aaf6011835a2a5e2db0e5c5c4ef4e"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.22.0"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3aef8ec3ae1b772f340170c65bf27d5b8c28f543a0116c844d2ac08d01123e7"
|
||||
checksum = "180f595432a5b615fc6b74afef3955249b86cfea72607b40740a4cd60d5297d0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"epaint",
|
||||
|
@ -1466,28 +1478,29 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "egui-baseview"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/BillyDM/egui-baseview.git?rev=27c027c22a83d2eb214074f922ba4115f712e483#27c027c22a83d2eb214074f922ba4115f712e483"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/BillyDM/egui-baseview.git?rev=1fe7e1d0081ab29474b0a5cdc567f60a3219b20d#1fe7e1d0081ab29474b0a5cdc567f60a3219b20d"
|
||||
dependencies = [
|
||||
"baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git?rev=1d9806d5bd92275d0d8142d9c9c90198757b9b25)",
|
||||
"copypasta 0.8.2",
|
||||
"baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git?rev=2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4)",
|
||||
"copypasta 0.10.0",
|
||||
"egui",
|
||||
"egui_glow",
|
||||
"keyboard-types",
|
||||
"raw-window-handle 0.4.3",
|
||||
"log",
|
||||
"raw-window-handle 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui_glow"
|
||||
version = "0.22.0"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f8c2752cdf1b0ef5fcda59a898cacabad974d4f5880e92a420b2c917022da64"
|
||||
checksum = "a08e3be8728b4c59493dbfec041c657e6725bdeafdbd49aef3f1dbb9e551fa01"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"egui",
|
||||
"glow 0.12.3",
|
||||
"glow 0.13.1",
|
||||
"log",
|
||||
"memoffset 0.6.5",
|
||||
"memoffset 0.9.0",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
@ -1500,9 +1513,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
|||
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.22.0"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3857d743a6e0741cdd60b622a74c7a36ea75f5f8f11b793b41d905d2c9721a4b"
|
||||
checksum = "6916301ecf80448f786cdf3eb51d9dbdd831538732229d49119e2d4312eaaf09"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
@ -1530,18 +1543,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.22.0"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09333964d4d57f40a85338ba3ca5ed4716070ab184dcfed966b35491c5c64f3b"
|
||||
checksum = "77b9fdf617dd7f58b0c8e6e9e4a1281f730cde0831d40547da446b2bb76a47af"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"ahash",
|
||||
"atomic_refcell",
|
||||
"bytemuck",
|
||||
"ecolor",
|
||||
"emath",
|
||||
"nohash-hasher",
|
||||
"parking_lot 0.12.1",
|
||||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1992,6 +2005,16 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gethostname"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.16"
|
||||
|
@ -2082,6 +2105,18 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glow"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"slotmap",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glow_glyph"
|
||||
version = "0.5.1"
|
||||
|
@ -2949,14 +2984,13 @@ dependencies = [
|
|||
name = "nih_plug_egui"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git?rev=1d9806d5bd92275d0d8142d9c9c90198757b9b25)",
|
||||
"baseview 0.1.0 (git+https://github.com/RustAudio/baseview.git?rev=2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4)",
|
||||
"crossbeam",
|
||||
"egui",
|
||||
"egui-baseview",
|
||||
"lazy_static",
|
||||
"nih_plug",
|
||||
"parking_lot 0.12.1",
|
||||
"raw-window-handle 0.4.3",
|
||||
"raw-window-handle 0.5.2",
|
||||
"serde",
|
||||
]
|
||||
|
||||
|
@ -5531,7 +5565,16 @@ version = "0.7.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464"
|
||||
dependencies = [
|
||||
"x11rb",
|
||||
"x11rb 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-clipboard"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b41aca1115b1f195f21c541c5efb423470848d48143127d0f07f8b90c27440df"
|
||||
dependencies = [
|
||||
"x11rb 0.12.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5551,11 +5594,24 @@ version = "0.10.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
|
||||
dependencies = [
|
||||
"gethostname",
|
||||
"gethostname 0.2.3",
|
||||
"nix 0.24.3",
|
||||
"winapi",
|
||||
"winapi-wsapoll",
|
||||
"x11rb-protocol",
|
||||
"x11rb-protocol 0.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11rb"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a"
|
||||
dependencies = [
|
||||
"gethostname 0.3.0",
|
||||
"nix 0.26.4",
|
||||
"winapi",
|
||||
"winapi-wsapoll",
|
||||
"x11rb-protocol 0.12.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5567,6 +5623,15 @@ dependencies = [
|
|||
"nix 0.24.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11rb-protocol"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc"
|
||||
dependencies = [
|
||||
"nix 0.26.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xcb"
|
||||
version = "0.9.0"
|
||||
|
|
|
@ -142,3 +142,6 @@ strip = "symbols"
|
|||
inherits = "release"
|
||||
debug = true
|
||||
strip = "none"
|
||||
|
||||
[toolchain]
|
||||
channel = "nightly"
|
||||
|
|
|
@ -8,27 +8,19 @@ license = "ISC"
|
|||
description = "An adapter to use egui GUIs with NIH-plug"
|
||||
|
||||
[features]
|
||||
default = ["egui-default-features", "opengl"]
|
||||
|
||||
# Use egui's default features
|
||||
egui-default-features = ["egui/default"]
|
||||
default = ["opengl", "default_fonts"]
|
||||
# `nih_plug_egui` always uses OpenGL since egui's wgpu backend is still unstable
|
||||
# depending on the platform
|
||||
opengl = []
|
||||
opengl = ["egui-baseview/opengl"]
|
||||
default_fonts = ["egui-baseview/default_fonts"]
|
||||
rayon = ["egui-baseview/rayon"]
|
||||
|
||||
[dependencies]
|
||||
nih_plug = { path = ".." }
|
||||
|
||||
# The currently targeted version of baseview uses a different version of
|
||||
# `raw_window_handle` than NIH-plug, so we need to manually convert between them
|
||||
raw-window-handle = "0.4"
|
||||
|
||||
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "1d9806d5bd92275d0d8142d9c9c90198757b9b25" }
|
||||
raw-window-handle = "0.5"
|
||||
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "2c1b1a7b0fef1a29a5150a6a8f6fef6a0cbab8c4" }
|
||||
crossbeam = "0.8"
|
||||
# The `egui-default-features` feature enables the default features. This makes
|
||||
# it possible to opt out of this if needed.
|
||||
egui = { version = "0.22", default-features = false }
|
||||
egui-baseview = { git = "https://github.com/BillyDM/egui-baseview.git", rev = "27c027c22a83d2eb214074f922ba4115f712e483" }
|
||||
egui-baseview = { git = "https://github.com/BillyDM/egui-baseview.git", rev = "1fe7e1d0081ab29474b0a5cdc567f60a3219b20d", default-features = false }
|
||||
lazy_static = "1.4"
|
||||
parking_lot = "0.12"
|
||||
# To make the state persistable
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use baseview::gl::GlConfig;
|
||||
use baseview::{Size, WindowHandle, WindowOpenOptions, WindowScalePolicy};
|
||||
use crossbeam::atomic::AtomicCell;
|
||||
use egui::Context;
|
||||
use egui_baseview::egui::Context;
|
||||
use egui_baseview::EguiWindow;
|
||||
use nih_plug::prelude::{Editor, GuiContext, ParamSetter, ParentWindowHandle};
|
||||
use parking_lot::RwLock;
|
||||
|
@ -37,17 +37,17 @@ unsafe impl HasRawWindowHandle for ParentWindowHandleAdapter {
|
|||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
match self.0 {
|
||||
ParentWindowHandle::X11Window(window) => {
|
||||
let mut handle = raw_window_handle::XcbHandle::empty();
|
||||
let mut handle = raw_window_handle::XcbWindowHandle::empty();
|
||||
handle.window = window;
|
||||
RawWindowHandle::Xcb(handle)
|
||||
}
|
||||
ParentWindowHandle::AppKitNsView(ns_view) => {
|
||||
let mut handle = raw_window_handle::AppKitHandle::empty();
|
||||
let mut handle = raw_window_handle::AppKitWindowHandle::empty();
|
||||
handle.ns_view = ns_view;
|
||||
RawWindowHandle::AppKit(handle)
|
||||
}
|
||||
ParentWindowHandle::Win32Hwnd(hwnd) => {
|
||||
let mut handle = raw_window_handle::Win32Handle::empty();
|
||||
let mut handle = raw_window_handle::Win32WindowHandle::empty();
|
||||
handle.hwnd = hwnd;
|
||||
RawWindowHandle::Win32(handle)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use std::sync::Arc;
|
|||
compile_error!("There's currently no software rendering support for egui");
|
||||
|
||||
/// Re-export for convenience.
|
||||
pub use egui;
|
||||
pub use egui_baseview::egui;
|
||||
|
||||
mod editor;
|
||||
pub mod widgets;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use std::sync::Arc;
|
||||
|
||||
use egui::{TextStyle, Ui, Vec2};
|
||||
use egui_baseview::egui::{self, TextStyle, Ui, Vec2};
|
||||
use nih_plug::prelude::{Param, ParamFlags, ParamPtr, ParamSetter, Params};
|
||||
|
||||
use super::ParamSlider;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use egui::{vec2, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2, Widget, WidgetText};
|
||||
use egui_baseview::egui::{
|
||||
self, emath, vec2, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2, Widget,
|
||||
WidgetText,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use nih_plug::prelude::{Param, ParamSetter};
|
||||
use parking_lot::Mutex;
|
||||
|
@ -35,7 +38,7 @@ pub struct ParamSlider<'a, P: Param> {
|
|||
slider_width: Option<f32>,
|
||||
|
||||
/// Will be set in the `ui()` function so we can request keyboard input focus on Alt+click.
|
||||
keyboard_focus_id: Option<egui::Id>,
|
||||
keyboard_focus_id: Option<egui_baseview::egui::Id>,
|
||||
}
|
||||
|
||||
impl<'a, P: Param> ParamSlider<'a, P> {
|
||||
|
@ -199,8 +202,7 @@ impl<'a, P: Param> ParamSlider<'a, P> {
|
|||
response.mark_changed();
|
||||
} else {
|
||||
let proportion =
|
||||
egui::emath::remap_clamp(click_pos.x, response.rect.x_range(), 0.0..=1.0)
|
||||
as f64;
|
||||
emath::remap_clamp(click_pos.x, response.rect.x_range(), 0.0..=1.0) as f64;
|
||||
self.set_normalized_value(proportion as f32);
|
||||
response.mark_changed();
|
||||
Self::set_drag_amount_memory(ui, 0.0);
|
||||
|
@ -301,7 +303,12 @@ impl<'a, P: Param> ParamSlider<'a, P> {
|
|||
.layout()
|
||||
.align_size_within_rect(text.size(), response.rect.shrink2(padding))
|
||||
.min;
|
||||
text.paint_with_visuals(ui.painter(), text_pos, &visuals);
|
||||
|
||||
ui.painter().add(egui::epaint::TextShape::new(
|
||||
text_pos,
|
||||
text,
|
||||
visuals.fg_stroke.color,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Utilities for creating these widgets.
|
||||
|
||||
use egui::Color32;
|
||||
use egui_baseview::egui::{self, Color32};
|
||||
|
||||
/// Additively modify the hue, saturation, and lightness [0, 1] values of a color.
|
||||
pub fn add_hsv(color: Color32, h: f32, s: f32, v: f32) -> Color32 {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use atomic_float::AtomicF32;
|
||||
use nih_plug::prelude::*;
|
||||
use nih_plug_egui::{create_egui_editor, egui, widgets, EguiState};
|
||||
use std::sync::Arc;
|
||||
|
|
Loading…
Reference in a new issue