From 8d4de866d4da1835b31e85f9068a5257e6ccbccb Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 8 Dec 2023 11:02:57 +0100 Subject: [PATCH] Remove deprecated functions (#3692) --- crates/egui/src/containers/area.rs | 7 ----- .../egui/src/containers/collapsing_header.rs | 30 ------------------- crates/egui/src/containers/frame.rs | 6 ---- crates/egui/src/containers/window.rs | 9 ------ crates/egui/src/context.rs | 10 ------- crates/egui/src/data/input.rs | 9 ------ crates/egui/src/data/output.rs | 8 ----- crates/egui/src/id.rs | 5 ---- crates/egui/src/memory.rs | 17 +---------- crates/egui/src/painter.rs | 10 ------- crates/egui/src/util/id_type_map.rs | 2 +- crates/egui/src/widgets/text_edit/builder.rs | 5 ---- crates/egui_extras/src/image.rs | 10 +------ crates/egui_extras/src/table.rs | 5 ---- crates/egui_glow/src/painter.rs | 5 ---- crates/egui_plot/src/items/mod.rs | 14 --------- crates/egui_plot/src/lib.rs | 18 ----------- crates/emath/src/rect.rs | 7 ----- crates/epaint/src/shape.rs | 11 ------- crates/epaint/src/stroke.rs | 8 +---- 20 files changed, 4 insertions(+), 192 deletions(-) diff --git a/crates/egui/src/containers/area.rs b/crates/egui/src/containers/area.rs index c1eab977da7..a8c1d417139 100644 --- a/crates/egui/src/containers/area.rs +++ b/crates/egui/src/containers/area.rs @@ -173,13 +173,6 @@ impl Area { self } - #[deprecated = "Use `constrain_to` instead"] - #[inline] - pub fn drag_bounds(mut self, constrain_rect: Rect) -> Self { - self.constrain_rect = Some(constrain_rect); - self - } - /// Where the "root" of the area is. /// /// For instance, if you set this to [`Align2::RIGHT_TOP`] diff --git a/crates/egui/src/containers/collapsing_header.rs b/crates/egui/src/containers/collapsing_header.rs index 2fc28d3dd51..96bf5cdef7e 100644 --- a/crates/egui/src/containers/collapsing_header.rs +++ b/crates/egui/src/containers/collapsing_header.rs @@ -424,36 +424,6 @@ impl CollapsingHeader { self } - /// Can the [`CollapsingHeader`] be selected by clicking it? Default: `false`. - #[deprecated = "Use the more powerful egui::collapsing_header::CollapsingState::show_header"] // Deprecated in 2022-04-28, before egui 0.18 - #[inline] - pub fn selectable(mut self, selectable: bool) -> Self { - self.selectable = selectable; - self - } - - /// If you set this to 'true', the [`CollapsingHeader`] will be shown as selected. - /// - /// Example: - /// ``` - /// # egui::__run_test_ui(|ui| { - /// let mut selected = false; - /// let response = egui::CollapsingHeader::new("Select and open me") - /// .selectable(true) - /// .selected(selected) - /// .show(ui, |ui| ui.label("Body")); - /// if response.header_response.clicked() { - /// selected = true; - /// } - /// # }); - /// ``` - #[deprecated = "Use the more powerful egui::collapsing_header::CollapsingState::show_header"] // Deprecated in 2022-04-28, before egui 0.18 - #[inline] - pub fn selected(mut self, selected: bool) -> Self { - self.selected = selected; - self - } - /// Should the [`CollapsingHeader`] show a background behind it? Default: `false`. /// /// To show it behind all [`CollapsingHeader`] you can just use: diff --git a/crates/egui/src/containers/frame.rs b/crates/egui/src/containers/frame.rs index 49829247193..01c04be79cf 100644 --- a/crates/egui/src/containers/frame.rs +++ b/crates/egui/src/containers/frame.rs @@ -152,12 +152,6 @@ impl Frame { self } - #[deprecated = "Renamed inner_margin in egui 0.18"] - #[inline] - pub fn margin(self, margin: impl Into) -> Self { - self.inner_margin(margin) - } - #[inline] pub fn shadow(mut self, shadow: Shadow) -> Self { self.shadow = shadow; diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index 66bb4a93081..cc0f28e90e5 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -209,15 +209,6 @@ impl<'open> Window<'open> { self } - #[deprecated = "Use `constrain_to` instead"] - #[inline] - pub fn drag_bounds(mut self, constrain_rect: Rect) -> Self { - #![allow(deprecated)] - - self.area = self.area.drag_bounds(constrain_rect); - self - } - /// Where the "root" of the window is. /// /// For instance, if you set this to [`Align2::RIGHT_TOP`] diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 503177d1ff4..c24a9d02ba7 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -707,16 +707,6 @@ impl Context { }) } - /// Read-write access to [`Fonts`]. - #[inline] - #[deprecated = "This function will be removed"] - pub fn fonts_mut(&self, writer: impl FnOnce(Option<&mut Fonts>) -> R) -> R { - self.write(move |ctx| { - let pixels_per_point = ctx.pixels_per_point(); - writer(ctx.fonts.get_mut(&pixels_per_point.into())) - }) - } - /// Read-only access to [`Options`]. #[inline] pub fn options(&self, reader: impl FnOnce(&Options) -> R) -> R { diff --git a/crates/egui/src/data/input.rs b/crates/egui/src/data/input.rs index 50073338b3c..e550c0a4717 100644 --- a/crates/egui/src/data/input.rs +++ b/crates/egui/src/data/input.rs @@ -572,15 +572,6 @@ impl Modifiers { command: false, }; - #[deprecated = "Use `Modifiers::ALT | Modifiers::SHIFT` instead"] - pub const ALT_SHIFT: Self = Self { - alt: true, - ctrl: false, - shift: true, - mac_cmd: false, - command: false, - }; - /// The Mac ⌘ Command key pub const MAC_CMD: Self = Self { alt: false, diff --git a/crates/egui/src/data/output.rs b/crates/egui/src/data/output.rs index 11275e7b800..f9ee018c3e4 100644 --- a/crates/egui/src/data/output.rs +++ b/crates/egui/src/data/output.rs @@ -111,14 +111,6 @@ pub struct PlatformOutput { } impl PlatformOutput { - /// Open the given url in a web browser. - /// - /// If egui is running in a browser, the same tab will be reused. - #[deprecated = "Use Context::open_url instead"] - pub fn open_url(&mut self, url: impl ToString) { - self.open_url = Some(OpenUrl::same_tab(url)); - } - /// This can be used by a text-to-speech system to describe the events (if any). pub fn events_description(&self) -> String { // only describe last event: diff --git a/crates/egui/src/id.rs b/crates/egui/src/id.rs index e588271d9d8..fe42d20fbfc 100644 --- a/crates/egui/src/id.rs +++ b/crates/egui/src/id.rs @@ -37,11 +37,6 @@ impl Id { /// though obviously it will lead to a lot of collisions if you do use it! pub const NULL: Self = Self(0); - #[deprecated = "Use Id::NULL"] - pub fn null() -> Self { - Self(0) - } - pub(crate) const fn background() -> Self { Self(1) } diff --git a/crates/egui/src/memory.rs b/crates/egui/src/memory.rs index fb15fdd3897..a96d8d973be 100644 --- a/crates/egui/src/memory.rs +++ b/crates/egui/src/memory.rs @@ -39,7 +39,7 @@ pub struct Memory { /// /// This will be saved between different program runs if you use the `persistence` feature. /// - /// To store a state common for all your widgets (a singleton), use [`Id::null`] as the key. + /// To store a state common for all your widgets (a singleton), use [`Id::NULL`] as the key. pub data: crate::util::IdTypeMap, // ------------------------------------------ @@ -666,21 +666,6 @@ impl Memory { } } - /// Set an event filter for a widget. - /// - /// You must first give focus to the widget before calling this. - #[deprecated = "Use set_focus_lock_filter instead"] - pub fn lock_focus(&mut self, id: Id, lock_focus: bool) { - self.set_focus_lock_filter( - id, - EventFilter { - tab: lock_focus, - arrows: lock_focus, - escape: false, - }, - ); - } - /// Give keyboard focus to a specific widget. /// See also [`crate::Response::request_focus`]. #[inline(always)] diff --git a/crates/egui/src/painter.rs b/crates/egui/src/painter.rs index a88862325a6..8376d16ed7b 100644 --- a/crates/egui/src/painter.rs +++ b/crates/egui/src/painter.rs @@ -83,16 +83,6 @@ impl Painter { pub(crate) fn set_invisible(&mut self) { self.fade_to_color = Some(Color32::TRANSPARENT); } - - #[deprecated = "Use Painter::with_clip_rect"] // Deprecated in 2022-04-18, before egui 0.18 - pub fn sub_region(&self, rect: Rect) -> Self { - Self { - ctx: self.ctx.clone(), - layer_id: self.layer_id, - clip_rect: rect.intersect(self.clip_rect), - fade_to_color: self.fade_to_color, - } - } } /// ## Accessors etc diff --git a/crates/egui/src/util/id_type_map.rs b/crates/egui/src/util/id_type_map.rs index 9e33849a991..d7af233ac25 100644 --- a/crates/egui/src/util/id_type_map.rs +++ b/crates/egui/src/util/id_type_map.rs @@ -318,7 +318,7 @@ use crate::Id; /// /// Values can either be "persisted" (serializable) or "temporary" (cleared when egui is shut down). /// -/// You can store state using the key [`Id::null`]. The state will then only be identified by its type. +/// You can store state using the key [`Id::NULL`]. The state will then only be identified by its type. /// /// ``` /// # use egui::{Id, util::IdTypeMap}; diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index d96a8a216f7..0b4bb0b9d9f 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -193,11 +193,6 @@ impl<'t> TextEdit<'t> { self } - #[deprecated = "Use .font(…) instead"] - pub fn text_style(self, text_style: TextStyle) -> Self { - self.font(text_style) - } - #[inline] pub fn text_color(mut self, text_color: Color32) -> Self { self.text_color = Some(text_color); diff --git a/crates/egui_extras/src/image.rs b/crates/egui_extras/src/image.rs index 1ad3cea6c7e..72be580d2c9 100644 --- a/crates/egui_extras/src/image.rs +++ b/crates/egui_extras/src/image.rs @@ -1,6 +1,6 @@ #![allow(deprecated)] -use egui::{mutex::Mutex, TextureFilter, TextureOptions}; +use egui::{mutex::Mutex, TextureOptions}; #[cfg(feature = "svg")] pub use usvg::FitTo; @@ -123,14 +123,6 @@ impl RetainedImage { self } - #[deprecated = "Use with_options instead"] - pub fn with_texture_filter(self, filter: TextureFilter) -> Self { - self.with_options(TextureOptions { - magnification: filter, - minification: filter, - }) - } - /// The size of the image data (number of pixels wide/high). pub fn size(&self) -> [usize; 2] { self.size diff --git a/crates/egui_extras/src/table.rs b/crates/egui_extras/src/table.rs index c456ba9645e..6659ed395ea 100644 --- a/crates/egui_extras/src/table.rs +++ b/crates/egui_extras/src/table.rs @@ -278,11 +278,6 @@ impl<'a> TableBuilder<'a> { self } - #[deprecated = "Renamed to vscroll"] - pub fn scroll(self, vscroll: bool) -> Self { - self.vscroll(vscroll) - } - /// Enables scrolling the table's contents using mouse drag (default: `true`). /// /// See [`ScrollArea::drag_to_scroll`] for more. diff --git a/crates/egui_glow/src/painter.rs b/crates/egui_glow/src/painter.rs index 2df12298c46..4f2d437f9aa 100644 --- a/crates/egui_glow/src/painter.rs +++ b/crates/egui_glow/src/painter.rs @@ -624,11 +624,6 @@ impl Painter { self.textures.get(&texture_id).copied() } - #[deprecated = "renamed 'texture'"] - pub fn get_texture(&self, texture_id: egui::TextureId) -> Option { - self.texture(texture_id) - } - #[allow(clippy::needless_pass_by_value)] // False positive pub fn register_native_texture(&mut self, native: glow::Texture) -> egui::TextureId { self.assert_not_destroyed(); diff --git a/crates/egui_plot/src/items/mod.rs b/crates/egui_plot/src/items/mod.rs index b49f6773cba..92d607570d8 100644 --- a/crates/egui_plot/src/items/mod.rs +++ b/crates/egui_plot/src/items/mod.rs @@ -574,20 +574,6 @@ impl Polygon { self } - #[deprecated = "Use `fill_color`."] - #[allow(unused, clippy::needless_pass_by_value)] - #[inline] - pub fn color(mut self, color: impl Into) -> Self { - self - } - - #[deprecated = "Use `fill_color`."] - #[allow(unused, clippy::needless_pass_by_value)] - #[inline] - pub fn fill_alpha(mut self, _alpha: impl Into) -> Self { - self - } - /// Fill color. Defaults to the stroke color with added transparency. #[inline] pub fn fill_color(mut self, color: impl Into) -> Self { diff --git a/crates/egui_plot/src/lib.rs b/crates/egui_plot/src/lib.rs index 61b902834e4..a10953311dc 100644 --- a/crates/egui_plot/src/lib.rs +++ b/crates/egui_plot/src/lib.rs @@ -1393,24 +1393,6 @@ impl PlotUi { &self.response } - /// Returns `true` if the plot area is currently hovered. - #[deprecated = "Use plot_ui.response().hovered()"] - pub fn plot_hovered(&self) -> bool { - self.response.hovered() - } - - /// Returns `true` if the plot was clicked by the primary button. - #[deprecated = "Use plot_ui.response().clicked()"] - pub fn plot_clicked(&self) -> bool { - self.response.clicked() - } - - /// Returns `true` if the plot was clicked by the secondary button. - #[deprecated = "Use plot_ui.response().secondary_clicked()"] - pub fn plot_secondary_clicked(&self) -> bool { - self.response.secondary_clicked() - } - /// The pointer position in plot coordinates. Independent of whether the pointer is in the plot area. pub fn pointer_coordinate(&self) -> Option { // We need to subtract the drag delta to keep in sync with the frame-delayed screen transform: diff --git a/crates/emath/src/rect.rs b/crates/emath/src/rect.rs index 69ff7d30384..e671135fce6 100644 --- a/crates/emath/src/rect.rs +++ b/crates/emath/src/rect.rs @@ -407,13 +407,6 @@ impl Rect { inside_dist + outside_dist } - /// Linearly interpolate so that `[0, 0]` is [`Self::min`] and - /// `[1, 1]` is [`Self::max`]. - #[deprecated = "Use `lerp_inside` instead"] - pub fn lerp(&self, t: Vec2) -> Pos2 { - self.lerp_inside(t) - } - /// Linearly interpolate so that `[0, 0]` is [`Self::min`] and /// `[1, 1]` is [`Self::max`]. pub fn lerp_inside(&self, t: Vec2) -> Pos2 { diff --git a/crates/epaint/src/shape.rs b/crates/epaint/src/shape.rs index 07e06cb3db6..8de1f0ffc1b 100644 --- a/crates/epaint/src/shape.rs +++ b/crates/epaint/src/shape.rs @@ -622,17 +622,6 @@ impl Rounding { } } - #[inline] - #[deprecated = "Use Rounding::ZERO"] - pub fn none() -> Self { - Self { - nw: 0.0, - ne: 0.0, - sw: 0.0, - se: 0.0, - } - } - /// Do all corners have the same rounding? #[inline] pub fn is_same(&self) -> bool { diff --git a/crates/epaint/src/stroke.rs b/crates/epaint/src/stroke.rs index 72f5a8cfddc..fca821b1ac0 100644 --- a/crates/epaint/src/stroke.rs +++ b/crates/epaint/src/stroke.rs @@ -4,7 +4,7 @@ use super::*; /// Describes the width and color of a line. /// -/// The default stroke is the same as [`Stroke::none`]. +/// The default stroke is the same as [`Stroke::NONE`]. #[derive(Clone, Copy, Debug, Default, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Stroke { @@ -19,12 +19,6 @@ impl Stroke { color: Color32::TRANSPARENT, }; - #[deprecated = "Use Stroke::NONE instead"] - #[inline(always)] - pub fn none() -> Self { - Self::new(0.0, Color32::TRANSPARENT) - } - #[inline] pub fn new(width: impl Into, color: impl Into) -> Self { Self {