mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Merge PR #201 (Bump egui versions)
https://github.com/robbert-vdh/nih-plug/pull/201
This commit is contained in:
@@ -12,6 +12,15 @@ state is to list breaking changes.
|
|||||||
|
|
||||||
## [2024-02-23]
|
## [2024-02-23]
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
- `nih_plug_egui` now uses egui 0.31.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `nih_plug_egui` has a new `ResizableWindow` widget that can be used to resize
|
||||||
|
the plugin's editor.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- The CLAP bindings were updated to 1.2.2. The only noticeable difference is
|
- The CLAP bindings were updated to 1.2.2. The only noticeable difference is
|
||||||
|
|||||||
1455
Cargo.lock
generated
1455
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -18,9 +18,9 @@ rayon = ["egui-baseview/rayon"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
nih_plug = { path = "..", default-features = false }
|
nih_plug = { path = "..", default-features = false }
|
||||||
raw-window-handle = "0.5"
|
raw-window-handle = "0.5"
|
||||||
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "45465c5f46abed6c6ce370fffde5edc8e4cd5aa3" }
|
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "9a0b42c09d712777b2edb4c5e0cb6baf21e988f0" }
|
||||||
crossbeam = "0.8"
|
crossbeam = "0.8"
|
||||||
egui-baseview = { git = "https://github.com/BillyDM/egui-baseview.git", rev = "87a6cbead6cf89ca27c2f0448e480e901cc2754d", default-features = false }
|
egui-baseview = { git = "https://github.com/BillyDM/egui-baseview.git", rev = "ec70c3fe6b2f070dcacbc22924431edbe24bd1c0" }
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
# To make the state persistable
|
# To make the state persistable
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ where
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
Default::default(),
|
||||||
state,
|
state,
|
||||||
move |egui_ctx, _queue, state| build(egui_ctx, &mut state.write()),
|
move |egui_ctx, _queue, state| build(egui_ctx, &mut state.write()),
|
||||||
move |egui_ctx, queue, state| {
|
move |egui_ctx, queue, state| {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! Resizable window wrapper for Egui editor.
|
//! Resizable window wrapper for Egui editor.
|
||||||
//!
|
|
||||||
//!
|
use egui_baseview::egui::emath::GuiRounding;
|
||||||
|
use egui_baseview::egui::{InnerResponse, UiBuilder};
|
||||||
|
|
||||||
use crate::egui::{pos2, CentralPanel, Context, Id, Rect, Response, Sense, Ui, Vec2};
|
use crate::egui::{pos2, CentralPanel, Context, Id, Rect, Response, Sense, Ui, Vec2};
|
||||||
use crate::EguiState;
|
use crate::EguiState;
|
||||||
use egui_baseview::egui::InnerResponse;
|
|
||||||
|
|
||||||
/// Adds a corner to the plugin window that can be dragged in order to resize it.
|
/// Adds a corner to the plugin window that can be dragged in order to resize it.
|
||||||
/// Resizing happens through plugin API, hence a custom implementation is needed.
|
/// Resizing happens through plugin API, hence a custom implementation is needed.
|
||||||
@@ -36,7 +36,8 @@ impl ResizableWindow {
|
|||||||
) -> InnerResponse<R> {
|
) -> InnerResponse<R> {
|
||||||
CentralPanel::default().show(context, move |ui| {
|
CentralPanel::default().show(context, move |ui| {
|
||||||
let ui_rect = ui.clip_rect();
|
let ui_rect = ui.clip_rect();
|
||||||
let mut content_ui = ui.child_ui(ui_rect, *ui.layout());
|
let mut content_ui =
|
||||||
|
ui.new_child(UiBuilder::new().max_rect(ui_rect).layout(*ui.layout()));
|
||||||
|
|
||||||
let ret = add_contents(&mut content_ui);
|
let ret = add_contents(&mut content_ui);
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ pub fn paint_resize_corner(ui: &Ui, response: &Response) {
|
|||||||
|
|
||||||
let painter = ui.painter();
|
let painter = ui.painter();
|
||||||
let rect = response.rect.translate(-Vec2::splat(2.0)); // move away from the corner
|
let rect = response.rect.translate(-Vec2::splat(2.0)); // move away from the corner
|
||||||
let cp = painter.round_pos_to_pixels(rect.max);
|
let cp = rect.max.round_to_pixels(painter.pixels_per_point());
|
||||||
|
|
||||||
let mut w = 2.0;
|
let mut w = 2.0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use std::sync::{Arc, LazyLock};
|
use std::sync::{Arc, LazyLock};
|
||||||
|
|
||||||
|
use egui_baseview::egui::emath::GuiRounding;
|
||||||
use egui_baseview::egui::{
|
use egui_baseview::egui::{
|
||||||
self, emath, vec2, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2, Widget,
|
self, emath, vec2, Key, Response, Sense, Stroke, TextEdit, TextStyle, Ui, Vec2, Widget,
|
||||||
WidgetText,
|
WidgetText,
|
||||||
@@ -236,6 +237,7 @@ impl<'a, P: Param> ParamSlider<'a, P> {
|
|||||||
response.rect,
|
response.rect,
|
||||||
0.0,
|
0.0,
|
||||||
Stroke::new(1.0, ui.visuals().widgets.active.bg_fill),
|
Stroke::new(1.0, ui.visuals().widgets.active.bg_fill),
|
||||||
|
egui::StrokeKind::Middle,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,9 +293,10 @@ impl<'a, P: Param> ParamSlider<'a, P> {
|
|||||||
let stroke = visuals.bg_stroke;
|
let stroke = visuals.bg_stroke;
|
||||||
ui.painter().rect(
|
ui.painter().rect(
|
||||||
response.rect.expand(visuals.expansion),
|
response.rect.expand(visuals.expansion),
|
||||||
visuals.rounding,
|
visuals.corner_radius,
|
||||||
fill,
|
fill,
|
||||||
stroke,
|
stroke,
|
||||||
|
egui::StrokeKind::Middle,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +326,7 @@ impl<P: Param> Widget for ParamSlider<'_, P> {
|
|||||||
let height = ui
|
let height = ui
|
||||||
.text_style_height(&TextStyle::Body)
|
.text_style_height(&TextStyle::Body)
|
||||||
.max(ui.spacing().interact_size.y * 0.8);
|
.max(ui.spacing().interact_size.y * 0.8);
|
||||||
let slider_height = ui.painter().round_to_pixel(height * 0.8);
|
let slider_height = (height * 0.8).round_to_pixels(ui.painter().pixels_per_point());
|
||||||
let mut response = ui
|
let mut response = ui
|
||||||
.vertical(|ui| {
|
.vertical(|ui| {
|
||||||
ui.allocate_space(vec2(slider_width, (height - slider_height) / 2.0));
|
ui.allocate_space(vec2(slider_width, (height - slider_height) / 2.0));
|
||||||
|
|||||||
Reference in New Issue
Block a user