From 0a9144f7f30ed1f6881ac1d3733e2985935ff938 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 28 Aug 2024 12:18:42 +0200 Subject: [PATCH] Remove wildcard imports (#5018) I removed (I hope so) all wildcard imports I found. For me on my pc this improved the build time: - for egui -5s - for eframe -12s * [x] I have followed the instructions in the PR template --- Cargo.toml | 3 +- crates/ecolor/src/cint_impl.rs | 2 +- crates/eframe/src/lib.rs | 2 +- crates/eframe/src/native/glow_integration.rs | 12 +++-- crates/eframe/src/native/wgpu_integration.rs | 4 +- crates/eframe/src/web/events.rs | 7 ++- crates/eframe/src/web/mod.rs | 6 ++- crates/egui-wgpu/src/lib.rs | 2 +- crates/egui-winit/src/lib.rs | 2 +- crates/egui/src/containers/area.rs | 13 +++-- .../egui/src/containers/collapsing_header.rs | 7 ++- crates/egui/src/containers/combo_box.rs | 8 +++- crates/egui/src/containers/frame.rs | 7 ++- crates/egui/src/containers/panel.rs | 25 +++++----- crates/egui/src/containers/popup.rs | 12 +++-- crates/egui/src/containers/resize.rs | 7 ++- crates/egui/src/containers/scroll_area.rs | 9 ++-- crates/egui/src/containers/window.rs | 9 ++-- crates/egui/src/context.rs | 48 ++++++++++++------- crates/egui/src/data/input.rs | 5 +- crates/egui/src/debug_text.rs | 4 +- crates/egui/src/frame_state.rs | 9 ++-- crates/egui/src/grid.rs | 10 +++- crates/egui/src/gui_zoom.rs | 4 +- crates/egui/src/hit_test.rs | 6 ++- crates/egui/src/input_state.rs | 10 +++- crates/egui/src/interaction.rs | 4 +- crates/egui/src/introspection.rs | 5 +- crates/egui/src/layers.rs | 4 +- crates/egui/src/layout.rs | 5 +- crates/egui/src/lib.rs | 2 +- crates/egui/src/load/bytes_loader.rs | 5 +- crates/egui/src/load/texture_loader.rs | 5 +- crates/egui/src/memory.rs | 2 +- crates/egui/src/menu.rs | 11 +++-- crates/egui/src/painter.rs | 2 +- crates/egui/src/placer.rs | 7 ++- crates/egui/src/style.rs | 15 ++++-- .../egui/src/text_selection/cursor_range.rs | 5 +- .../src/text_selection/text_cursor_state.rs | 7 ++- crates/egui/src/text_selection/visuals.rs | 2 +- crates/egui/src/ui.rs | 36 ++++++++++---- crates/egui/src/widget_rect.rs | 10 ++-- crates/egui/src/widgets/button.rs | 9 ++-- crates/egui/src/widgets/checkbox.rs | 5 +- crates/egui/src/widgets/color_picker.rs | 10 +++- crates/egui/src/widgets/drag_value.rs | 13 +++-- crates/egui/src/widgets/hyperlink.rs | 5 +- crates/egui/src/widgets/image.rs | 15 +++--- crates/egui/src/widgets/image_button.rs | 5 +- crates/egui/src/widgets/label.rs | 7 ++- crates/egui/src/widgets/mod.rs | 2 +- crates/egui/src/widgets/progress_bar.rs | 5 +- crates/egui/src/widgets/radio_button.rs | 5 +- crates/egui/src/widgets/selected_label.rs | 4 +- crates/egui/src/widgets/separator.rs | 4 +- crates/egui/src/widgets/slider.rs | 14 ++++-- crates/egui/src/widgets/text_edit/builder.rs | 12 +++-- crates/egui/src/widgets/text_edit/state.rs | 7 +-- .../egui_demo_app/src/apps/fractal_clock.rs | 7 ++- crates/egui_demo_app/src/frame_history.rs | 2 +- crates/egui_demo_app/src/wrap_app.rs | 2 +- .../egui_demo_lib/src/demo/dancing_strings.rs | 7 ++- .../egui_demo_lib/src/demo/drag_and_drop.rs | 2 +- .../src/demo/misc_demo_window.rs | 7 ++- crates/egui_demo_lib/src/demo/paint_bezier.rs | 5 +- crates/egui_demo_lib/src/demo/painting.rs | 2 +- crates/egui_demo_lib/src/demo/pan_zoom.rs | 2 +- crates/egui_demo_lib/src/demo/scrolling.rs | 5 +- crates/egui_demo_lib/src/demo/sliders.rs | 2 +- .../src/demo/tests/layout_test.rs | 2 +- .../src/demo/tests/window_resize_test.rs | 2 +- .../src/easy_mark/easy_mark_editor.rs | 4 +- .../src/easy_mark/easy_mark_viewer.rs | 5 +- crates/egui_demo_lib/src/rendering_test.rs | 7 ++- crates/egui_extras/src/lib.rs | 2 +- crates/egui_glow/src/lib.rs | 2 +- crates/emath/src/align.rs | 2 +- crates/emath/src/ordered_float.rs | 2 +- crates/emath/src/pos2.rs | 2 +- crates/emath/src/rect.rs | 2 +- crates/epaint/benches/benchmark.rs | 5 +- crates/epaint/src/bezier.rs | 4 +- crates/epaint/src/lib.rs | 2 +- crates/epaint/src/mesh.rs | 4 +- crates/epaint/src/shadow.rs | 2 +- crates/epaint/src/shape.rs | 2 +- crates/epaint/src/shape_transform.rs | 5 +- crates/epaint/src/stats.rs | 2 +- crates/epaint/src/stroke.rs | 2 +- crates/epaint/src/tessellator.rs | 20 ++++---- crates/epaint/src/text/font.rs | 2 +- crates/epaint/src/text/text_layout.rs | 2 +- crates/epaint/src/text/text_layout_types.rs | 7 ++- examples/custom_window_frame/src/main.rs | 4 +- examples/file_dialog/src/main.rs | 2 +- examples/keyboard_events/src/main.rs | 2 +- examples/popups/src/main.rs | 2 +- scripts/check.sh | 5 +- 99 files changed, 423 insertions(+), 208 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 21e8d847e23..f1a4004952f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -118,6 +118,7 @@ unused_qualifications = "allow" [workspace.lints.rustdoc] all = "warn" missing_crate_level_docs = "warn" +broken_intra_doc_links = "warn" # See also clippy.toml [workspace.lints.clippy] @@ -248,6 +249,7 @@ use_self = "warn" useless_transmute = "warn" verbose_file_reads = "warn" wildcard_dependencies = "warn" +wildcard_imports = "warn" zero_sized_map_values = "warn" # TODO(emilk): enable more of these lints: @@ -262,4 +264,3 @@ unwrap_used = "allow" # TODO(emilk): We really wanna warn on thi manual_range_contains = "allow" # this one is just worse imho self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602 significant_drop_tightening = "allow" # Too many false positives -wildcard_imports = "allow" # we do this a lot in egui diff --git a/crates/ecolor/src/cint_impl.rs b/crates/ecolor/src/cint_impl.rs index 03758bba7ec..5d34e5e36f7 100644 --- a/crates/ecolor/src/cint_impl.rs +++ b/crates/ecolor/src/cint_impl.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{linear_f32_from_linear_u8, linear_u8_from_linear_f32, Color32, Hsva, HsvaGamma, Rgba}; use cint::{Alpha, ColorInterop, EncodedSrgb, Hsv, LinearSrgb, PremultipliedAlpha}; // ---- Color32 ---- diff --git a/crates/eframe/src/lib.rs b/crates/eframe/src/lib.rs index 09f77d743e5..d3849efa5d7 100644 --- a/crates/eframe/src/lib.rs +++ b/crates/eframe/src/lib.rs @@ -474,4 +474,4 @@ mod profiling_scopes { } #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::{profile_function, profile_scope}; diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index 87116b71227..599420e597d 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -1,4 +1,4 @@ -//! Note that this file contains code very similar to [`wgpu_integration`]. +//! Note that this file contains code very similar to [`super::wgpu_integration`]. //! When making changes to one you often also want to apply it to the other. //! //! This is also very complex code, and not very pretty. @@ -36,13 +36,13 @@ use egui::{ use egui_winit::accesskit_winit; use crate::{ - native::{epi_integration::EpiIntegration, winit_integration::create_egui_context}, - App, AppCreator, CreationContext, NativeOptions, Result, Storage, + native::epi_integration::EpiIntegration, App, AppCreator, CreationContext, NativeOptions, + Result, Storage, }; use super::{ - winit_integration::{EventResult, UserEvent, WinitApp}, - *, + epi_integration, event_loop_context, + winit_integration::{create_egui_context, EventResult, UserEvent, WinitApp}, }; // ---------------------------------------------------------------------------- @@ -462,6 +462,8 @@ impl WinitApp for GlowWinitApp { #[cfg(feature = "accesskit")] fn on_accesskit_event(&mut self, event: accesskit_winit::Event) -> crate::Result { + use super::winit_integration; + if let Some(running) = &self.running { let mut glutin = running.glutin.borrow_mut(); if let Some(viewport_id) = glutin.viewport_from_window.get(&event.window_id).copied() { diff --git a/crates/eframe/src/native/wgpu_integration.rs b/crates/eframe/src/native/wgpu_integration.rs index 0bcce42c638..9cbd9675e9c 100644 --- a/crates/eframe/src/native/wgpu_integration.rs +++ b/crates/eframe/src/native/wgpu_integration.rs @@ -1,4 +1,4 @@ -//! Note that this file contains code very similar to [`glow_integration`]. +//! Note that this file contains code very similar to [`super::glow_integration`]. //! When making changes to one you often also want to apply it to the other. //! //! This is also very complex code, and not very pretty. @@ -29,7 +29,7 @@ use crate::{ App, AppCreator, CreationContext, NativeOptions, Result, Storage, }; -use super::{winit_integration::WinitApp, *}; +use super::{epi_integration, event_loop_context, winit_integration, winit_integration::WinitApp}; // ---------------------------------------------------------------------------- // Types: diff --git a/crates/eframe/src/web/events.rs b/crates/eframe/src/web/events.rs index c5e58d35e15..6755e2b6483 100644 --- a/crates/eframe/src/web/events.rs +++ b/crates/eframe/src/web/events.rs @@ -1,4 +1,9 @@ -use super::*; +use super::{ + button_from_mouse_event, location_hash, modifiers_from_kb_event, modifiers_from_mouse_event, + modifiers_from_wheel_event, pos_from_mouse_event, prefers_color_scheme_dark, primary_touch_pos, + push_touches, text_from_keyboard_event, theme_from_dark_mode, translate_key, AppRunner, + Closure, JsCast, JsValue, WebRunner, +}; use web_sys::EventTarget; // TODO(emilk): there are more calls to `prevent_default` and `stop_propagaton` diff --git a/crates/eframe/src/web/mod.rs b/crates/eframe/src/web/mod.rs index 7e6a5101216..746b619fb30 100644 --- a/crates/eframe/src/web/mod.rs +++ b/crates/eframe/src/web/mod.rs @@ -43,7 +43,11 @@ pub use backend::*; use wasm_bindgen::prelude::*; use web_sys::MediaQueryList; -use input::*; +use input::{ + button_from_mouse_event, modifiers_from_kb_event, modifiers_from_mouse_event, + modifiers_from_wheel_event, pos_from_mouse_event, primary_touch_pos, push_touches, + text_from_keyboard_event, translate_key, +}; // ---------------------------------------------------------------------------- diff --git a/crates/egui-wgpu/src/lib.rs b/crates/egui-wgpu/src/lib.rs index 1189c1e20ad..972351ee64c 100644 --- a/crates/egui-wgpu/src/lib.rs +++ b/crates/egui-wgpu/src/lib.rs @@ -433,4 +433,4 @@ mod profiling_scopes { } #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::{profile_function, profile_scope}; diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index c35d2878227..1a546794cb1 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -26,7 +26,7 @@ use ahash::HashSet; use raw_window_handle::HasDisplayHandle; #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::{profile_function, profile_scope}; use winit::{ dpi::{PhysicalPosition, PhysicalSize}, diff --git a/crates/egui/src/containers/area.rs b/crates/egui/src/containers/area.rs index 196c3de2cab..378b0edc8d9 100644 --- a/crates/egui/src/containers/area.rs +++ b/crates/egui/src/containers/area.rs @@ -2,7 +2,10 @@ //! It has no frame or own size. It is potentially movable. //! It is the foundation for windows and popups. -use crate::*; +use crate::{ + emath, pos2, Align2, Context, Id, InnerResponse, LayerId, NumExt, Order, Pos2, Rect, Response, + Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, WidgetRect, WidgetWithState, +}; /// State of an [`Area`] that is persisted between frames. /// @@ -21,8 +24,8 @@ pub struct AreaState { /// /// Area size is intentionally NOT persisted between sessions, /// so that a bad tooltip or menu size won't be remembered forever. - /// A resizable [`Window`] remembers the size the user picked using - /// the state in the [`Resize`] container. + /// A resizable [`crate::Window`] remembers the size the user picked using + /// the state in the [`crate::Resize`] container. #[cfg_attr(feature = "serde", serde(skip))] pub size: Option, @@ -83,7 +86,7 @@ impl AreaState { /// An area on the screen that can be moved by dragging. /// -/// This forms the base of the [`Window`] container. +/// This forms the base of the [`crate::Window`] container. /// /// ``` /// # egui::__run_test_ctx(|ctx| { @@ -232,7 +235,7 @@ impl Area { /// If the contents are smaller than this size, the area will shrink to fit the contents. /// If the contents overflow, the area will grow. /// - /// If not set, [`style::Spacing::default_area_size`] will be used. + /// If not set, [`crate::style::Spacing::default_area_size`] will be used. #[inline] pub fn default_size(mut self, default_size: impl Into) -> Self { self.default_size = default_size.into(); diff --git a/crates/egui/src/containers/collapsing_header.rs b/crates/egui/src/containers/collapsing_header.rs index e0c298980f3..70fd3736bc0 100644 --- a/crates/egui/src/containers/collapsing_header.rs +++ b/crates/egui/src/containers/collapsing_header.rs @@ -1,6 +1,9 @@ use std::hash::Hash; -use crate::*; +use crate::{ + emath, epaint, pos2, remap, remap_clamp, vec2, Context, Id, InnerResponse, NumExt, Rect, + Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, WidgetInfo, WidgetText, WidgetType, +}; use epaint::Shape; #[derive(Clone, Copy, Debug)] @@ -15,7 +18,7 @@ pub(crate) struct InnerState { /// This is a a building block for building collapsing regions. /// -/// It is used by [`CollapsingHeader`] and [`Window`], but can also be used on its own. +/// It is used by [`CollapsingHeader`] and [`crate::Window`], but can also be used on its own. /// /// See [`CollapsingState::show_header`] for how to show a collapsing header with a custom header. #[derive(Clone, Debug)] diff --git a/crates/egui/src/containers/combo_box.rs b/crates/egui/src/containers/combo_box.rs index 5c6af803b3e..75305425e42 100644 --- a/crates/egui/src/containers/combo_box.rs +++ b/crates/egui/src/containers/combo_box.rs @@ -1,6 +1,10 @@ use epaint::Shape; -use crate::{style::WidgetVisuals, *}; +use crate::{ + epaint, style::WidgetVisuals, vec2, Align2, Context, Id, InnerResponse, NumExt, Painter, + PopupCloseBehavior, Rect, Response, ScrollArea, Sense, Stroke, TextStyle, TextWrapMode, Ui, + UiBuilder, Vec2, WidgetInfo, WidgetText, WidgetType, +}; #[allow(unused_imports)] // Documentation use crate::style::Spacing; @@ -150,7 +154,7 @@ impl ComboBox { /// Controls the wrap mode used for the selected text. /// - /// By default, [`Ui::wrap_mode`] will be used, which can be overridden with [`Style::wrap_mode`]. + /// By default, [`Ui::wrap_mode`] will be used, which can be overridden with [`crate::Style::wrap_mode`]. /// /// Note that any `\n` in the text will always produce a new line. #[inline] diff --git a/crates/egui/src/containers/frame.rs b/crates/egui/src/containers/frame.rs index f59598400b4..432356a870f 100644 --- a/crates/egui/src/containers/frame.rs +++ b/crates/egui/src/containers/frame.rs @@ -1,7 +1,10 @@ //! Frame container -use crate::{layers::ShapeIdx, *}; -use epaint::*; +use crate::{ + epaint, layers::ShapeIdx, InnerResponse, Response, Sense, Style, Ui, UiBuilder, UiKind, + UiStackInfo, +}; +use epaint::{Color32, Margin, Rect, Rounding, Shadow, Shape, Stroke}; /// Add a background, frame and/or margin to a rectangular background of a [`Ui`]. /// diff --git a/crates/egui/src/containers/panel.rs b/crates/egui/src/containers/panel.rs index 9aafa0cfae1..eaffa0be15e 100644 --- a/crates/egui/src/containers/panel.rs +++ b/crates/egui/src/containers/panel.rs @@ -3,7 +3,7 @@ //! Panels can either be a child of a [`Ui`] (taking up a portion of the parent) //! or be top-level (taking up a portion of the whole screen). //! -//! Together with [`Window`] and [`Area`]:s, top-level panels are +//! Together with [`crate::Window`] and [`crate::Area`]:s, top-level panels are //! the only places where you can put you widgets. //! //! The order in which you add panels matter! @@ -13,9 +13,12 @@ //! //! ⚠ Always add any [`CentralPanel`] last. //! -//! Add your [`Window`]:s after any top-level panels. +//! Add your [`crate::Window`]:s after any top-level panels. -use crate::*; +use crate::{ + lerp, vec2, Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt, + Rangef, Rect, Sense, Stroke, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, +}; fn animate_expansion(ctx: &Context, id: Id, is_expanded: bool) -> f32 { ctx.animate_bool_responsive(id, is_expanded) @@ -135,9 +138,9 @@ impl SidePanel { /// If you want your panel to be resizable you also need a widget in it that /// takes up more space as you resize it, such as: /// * Wrapping text ([`Ui::horizontal_wrapped`]). - /// * A [`ScrollArea`]. - /// * A [`Separator`]. - /// * A [`TextEdit`]. + /// * A [`crate::ScrollArea`]. + /// * A [`crate::Separator`]. + /// * A [`crate::TextEdit`]. /// * … #[inline] pub fn resizable(mut self, resizable: bool) -> Self { @@ -613,9 +616,9 @@ impl TopBottomPanel { /// If you want your panel to be resizable you also need a widget in it that /// takes up more space as you resize it, such as: /// * Wrapping text ([`Ui::horizontal_wrapped`]). - /// * A [`ScrollArea`]. - /// * A [`Separator`]. - /// * A [`TextEdit`]. + /// * A [`crate::ScrollArea`]. + /// * A [`crate::Separator`]. + /// * A [`crate::TextEdit`]. /// * … #[inline] pub fn resizable(mut self, resizable: bool) -> Self { @@ -633,7 +636,7 @@ impl TopBottomPanel { } /// The initial height of the [`TopBottomPanel`], including margins. - /// Defaults to [`style::Spacing::interact_size`].y, plus frame margins. + /// Defaults to [`crate::style::Spacing::interact_size`].y, plus frame margins. #[inline] pub fn default_height(mut self, default_height: f32) -> Self { self.default_height = Some(default_height); @@ -1041,7 +1044,7 @@ impl TopBottomPanel { /// /// ⚠ [`CentralPanel`] must be added after all other panels! /// -/// NOTE: Any [`Window`]s and [`Area`]s will cover the top-level [`CentralPanel`]. +/// NOTE: Any [`crate::Window`]s and [`crate::Area`]s will cover the top-level [`CentralPanel`]. /// /// See the [module level docs](crate::containers::panel) for more details. /// diff --git a/crates/egui/src/containers/popup.rs b/crates/egui/src/containers/popup.rs index d7fc9354a21..959d653fffb 100644 --- a/crates/egui/src/containers/popup.rs +++ b/crates/egui/src/containers/popup.rs @@ -2,7 +2,11 @@ use frame_state::PerWidgetTooltipState; -use crate::*; +use crate::{ + frame_state, vec2, AboveOrBelow, Align, Align2, Area, AreaState, Context, Frame, Id, + InnerResponse, Key, LayerId, Layout, Order, Pos2, Rect, Response, Sense, Ui, UiKind, Vec2, + Widget, WidgetText, +}; // ---------------------------------------------------------------------------- @@ -322,14 +326,14 @@ pub fn was_tooltip_open_last_frame(ctx: &Context, widget_id: Id) -> bool { pub enum PopupCloseBehavior { /// Popup will be closed on click anywhere, inside or outside the popup. /// - /// It is used in [`ComboBox`]. + /// It is used in [`crate::ComboBox`]. CloseOnClick, /// Popup will be closed if the click happened somewhere else /// but in the popup's body CloseOnClickOutside, - /// Clicks will be ignored. Popup might be closed manually by calling [`Memory::close_popup`] + /// Clicks will be ignored. Popup might be closed manually by calling [`crate::Memory::close_popup`] /// or by pressing the escape button IgnoreClicks, } @@ -358,7 +362,7 @@ pub fn popup_below_widget( /// /// The opened popup will have a minimum width matching its parent. /// -/// You must open the popup with [`Memory::open_popup`] or [`Memory::toggle_popup`]. +/// You must open the popup with [`crate::Memory::open_popup`] or [`crate::Memory::toggle_popup`]. /// /// Returns `None` if the popup is not open. /// diff --git a/crates/egui/src/containers/resize.rs b/crates/egui/src/containers/resize.rs index 54a00af0eb7..98518bcef11 100644 --- a/crates/egui/src/containers/resize.rs +++ b/crates/egui/src/containers/resize.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + pos2, vec2, Align2, Color32, Context, CursorIcon, Id, NumExt, Rect, Response, Sense, Shape, Ui, + UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b, +}; #[derive(Clone, Copy, Debug)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] @@ -88,7 +91,7 @@ impl Resize { /// Preferred / suggested height. Actual height will depend on contents. /// /// Examples: - /// * if the contents is a [`ScrollArea`] then this decides the maximum size. + /// * if the contents is a [`crate::ScrollArea`] then this decides the maximum size. /// * if the contents is a canvas, this decides the height of it, /// * if the contents is text and buttons, then the `default_height` is ignored /// and the height is picked automatically.. diff --git a/crates/egui/src/containers/scroll_area.rs b/crates/egui/src/containers/scroll_area.rs index aaccb2d7209..0cac8181e10 100644 --- a/crates/egui/src/containers/scroll_area.rs +++ b/crates/egui/src/containers/scroll_area.rs @@ -1,6 +1,9 @@ #![allow(clippy::needless_range_loop)] -use crate::*; +use crate::{ + emath, epaint, frame_state, lerp, pos2, remap, remap_clamp, vec2, Context, Id, NumExt, Pos2, + Rangef, Rect, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b, +}; #[derive(Clone, Copy, Debug)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] @@ -157,7 +160,7 @@ impl ScrollBarVisibility { /// # }); /// ``` /// -/// You can scroll to an element using [`Response::scroll_to_me`], [`Ui::scroll_to_cursor`] and [`Ui::scroll_to_rect`]. +/// You can scroll to an element using [`crate::Response::scroll_to_me`], [`Ui::scroll_to_cursor`] and [`Ui::scroll_to_rect`]. #[derive(Clone, Debug)] #[must_use = "You should call .show()"] pub struct ScrollArea { @@ -367,7 +370,7 @@ impl ScrollArea { /// * If `false`, the scroll area will not respond to user scrolling. /// /// This can be used, for example, to optionally freeze scrolling while the user - /// is typing text in a [`TextEdit`] widget contained within the scroll area. + /// is typing text in a [`crate::TextEdit`] widget contained within the scroll area. /// /// This controls both scrolling directions. #[inline] diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index eb76230e11d..eb7184c6e22 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -3,10 +3,13 @@ use std::sync::Arc; use crate::collapsing_header::CollapsingState; -use crate::*; -use epaint::*; +use crate::{ + Align, Align2, Context, CursorIcon, Id, InnerResponse, LayerId, NumExt, Order, Response, Sense, + TextStyle, Ui, UiKind, Vec2b, WidgetRect, WidgetText, +}; +use epaint::{emath, pos2, vec2, Galley, Pos2, Rect, RectShape, Rounding, Shape, Stroke, Vec2}; -use super::*; +use super::{area, resize, Area, Frame, Resize, ScrollArea}; /// Builder for a floating window which can be dragged, closed, collapsed, resized and scrolled (off by default). /// diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index a4ca219a1b4..ff13c14d764 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -4,24 +4,40 @@ use std::{borrow::Cow, cell::RefCell, panic::Location, sync::Arc, time::Duration use containers::area::AreaState; use epaint::{ - emath::TSTransform, mutex::*, stats::*, text::Fonts, util::OrderedFloat, TessellationOptions, *, + emath, emath::TSTransform, mutex::RwLock, pos2, stats::PaintStats, tessellator, text::Fonts, + util::OrderedFloat, vec2, ClippedPrimitive, ClippedShape, Color32, ImageData, ImageDelta, Pos2, + Rect, TessellationOptions, TextureAtlas, TextureId, Vec2, }; use crate::{ animation_manager::AnimationManager, + containers, data::output::PlatformOutput, + epaint, frame_state::FrameState, - input_state::*, + hit_test, + input_state::{InputState, MultiTouchInfo, PointerEvent}, + interaction, layers::GraphicLayers, + load, load::{Bytes, Loaders, SizedTexture}, memory::Options, + menu, os::OperatingSystem, output::FullOutput, + resize, scroll_area, util::IdTypeMap, viewport::ViewportClass, - TextureHandle, ViewportCommand, *, + Align2, CursorIcon, DeferredViewportUiCallback, FontDefinitions, Grid, Id, ImmediateViewport, + ImmediateViewportRendererCallback, Key, KeyboardShortcut, Label, LayerId, Memory, + ModifierNames, NumExt, Order, Painter, RawInput, Response, RichText, ScrollArea, Sense, Style, + TextStyle, TextureHandle, TextureOptions, Ui, ViewportBuilder, ViewportCommand, ViewportId, + ViewportIdMap, ViewportIdPair, ViewportIdSet, ViewportOutput, Widget, WidgetRect, WidgetText, }; +#[cfg(feature = "accesskit")] +use crate::IdMap; + use self::{hit_test::WidgetHits, interaction::InteractionSnapshot}; /// Information given to the backend about when it is time to repaint the ui. @@ -723,7 +739,7 @@ impl Context { /// Run the ui code for one frame. /// - /// Put your widgets into a [`SidePanel`], [`TopBottomPanel`], [`CentralPanel`], [`Window`] or [`Area`]. + /// Put your widgets into a [`crate::SidePanel`], [`crate::TopBottomPanel`], [`crate::CentralPanel`], [`crate::Window`] or [`crate::Area`]. /// /// This will modify the internal reference to point to a new generation of [`Context`]. /// Any old clones of this [`Context`] will refer to the old [`Context`], which will not get new input. @@ -1224,7 +1240,7 @@ impl Context { /// This is called by [`Response::widget_info`], but can also be called directly. /// - /// With some debug flags it will store the widget info in [`WidgetRects`] for later display. + /// With some debug flags it will store the widget info in [`crate::WidgetRects`] for later display. #[inline] pub fn register_widget_info(&self, id: Id, make_info: impl Fn() -> crate::WidgetInfo) { #[cfg(debug_assertions)] @@ -1326,7 +1342,7 @@ impl Context { /// Format the given shortcut in a human-readable way (e.g. `Ctrl+Shift+X`). /// - /// Can be used to get the text for [`Button::shortcut_text`]. + /// Can be used to get the text for [`crate::Button::shortcut_text`]. pub fn format_shortcut(&self, shortcut: &KeyboardShortcut) -> String { let os = self.os(); @@ -1623,7 +1639,7 @@ impl Context { self.options_mut(|opt| opt.style = style.into()); } - /// The [`Visuals`] used by all subsequent windows, panels etc. + /// The [`crate::Visuals`] used by all subsequent windows, panels etc. /// /// You can also use [`Ui::visuals_mut`] to change the visuals of a single [`Ui`]. /// @@ -1656,7 +1672,7 @@ impl Context { /// The number of physical pixels for each logical point on this monitor. /// - /// This is given as input to egui via [`ViewportInfo::native_pixels_per_point`] + /// This is given as input to egui via [`crate::ViewportInfo::native_pixels_per_point`] /// and cannot be changed. #[inline(always)] pub fn native_pixels_per_point(&self) -> Option { @@ -1744,7 +1760,7 @@ impl Context { /// /// The given name can be useful for later debugging, and will be visible if you call [`Self::texture_ui`]. /// - /// For how to load an image, see [`ImageData`] and [`ColorImage::from_rgba_unmultiplied`]. + /// For how to load an image, see [`crate::ImageData`] and [`crate::ColorImage::from_rgba_unmultiplied`]. /// /// ``` /// struct MyImage { @@ -2263,7 +2279,7 @@ impl Context { /// True if egui is currently interested in the pointer (mouse or touch). /// - /// Could be the pointer is hovering over a [`Window`] or the user is dragging a widget. + /// Could be the pointer is hovering over a [`crate::Window`] or the user is dragging a widget. /// If `false`, the pointer is outside of any egui area and so /// you may be interested in what it is doing (e.g. controlling your game). /// Returns `false` if a drag started outside of egui and then moved over an egui area. @@ -2279,7 +2295,7 @@ impl Context { self.memory(|m| m.interaction().is_using_pointer()) } - /// If `true`, egui is currently listening on text input (e.g. typing text in a [`TextEdit`]). + /// If `true`, egui is currently listening on text input (e.g. typing text in a [`crate::TextEdit`]). pub fn wants_keyboard_input(&self) -> bool { self.memory(|m| m.focused().is_some()) } @@ -2320,7 +2336,7 @@ impl Context { /// If you detect a click or drag and wants to know where it happened, use this. /// - /// Latest position of the mouse, but ignoring any [`Event::PointerGone`] + /// Latest position of the mouse, but ignoring any [`crate::Event::PointerGone`] /// if there were interactions this frame. /// When tapping a touch screen, this will be the location of the touch. #[inline(always)] @@ -2389,7 +2405,7 @@ impl Context { /// Moves the given area to the top in its [`Order`]. /// - /// [`Area`]:s and [`Window`]:s also do this automatically when being clicked on or interacted with. + /// [`crate::Area`]:s and [`crate::Window`]:s also do this automatically when being clicked on or interacted with. pub fn move_to_top(&self, layer_id: LayerId) { self.memory_mut(|mem| mem.areas_mut().move_to_top(layer_id)); } @@ -2397,7 +2413,7 @@ impl Context { /// Mark the `child` layer as a sublayer of `parent`. /// /// Sublayers are moved directly above the parent layer at the end of the frame. This is mainly - /// intended for adding a new [`Area`] inside a [`Window`]. + /// intended for adding a new [`crate::Area`] inside a [`crate::Window`]. /// /// This currently only supports one level of nesting. If `parent` is a sublayer of another /// layer, the behavior is unspecified. @@ -2582,7 +2598,7 @@ impl Context { /// Show the state of egui, including its input and output. pub fn inspection_ui(&self, ui: &mut Ui) { - use crate::containers::*; + use crate::containers::CollapsingHeader; ui.label(format!("Is using pointer: {}", self.is_using_pointer())) .on_hover_text( @@ -2985,7 +3001,7 @@ impl Context { } } - /// Release all memory and textures related to images used in [`Ui::image`] or [`Image`]. + /// Release all memory and textures related to images used in [`Ui::image`] or [`crate::Image`]. /// /// If you attempt to load any images again, they will be reloaded from scratch. pub fn forget_all_images(&self) { diff --git a/crates/egui/src/data/input.rs b/crates/egui/src/data/input.rs index 43fa9b6684f..c1b175dd843 100644 --- a/crates/egui/src/data/input.rs +++ b/crates/egui/src/data/input.rs @@ -2,7 +2,10 @@ use epaint::ColorImage; -use crate::{emath::*, Key, Theme, ViewportId, ViewportIdMap}; +use crate::{ + emath::{Pos2, Rect, Vec2}, + Key, Theme, ViewportId, ViewportIdMap, +}; /// What the integrations provides to egui at the start of each frame. /// diff --git a/crates/egui/src/debug_text.rs b/crates/egui/src/debug_text.rs index 672bc20c6a6..23f41243cb8 100644 --- a/crates/egui/src/debug_text.rs +++ b/crates/egui/src/debug_text.rs @@ -5,7 +5,9 @@ //! The plugin registers itself onto a specific [`Context`] //! to get callbacks on certain events ([`Context::on_begin_frame`], [`Context::on_end_frame`]). -use crate::*; +use crate::{ + text, Align, Align2, Color32, Context, FontFamily, FontId, Id, Rect, Shape, Vec2, WidgetText, +}; /// Register this plugin on the given egui context, /// so that it will be called every frame. diff --git a/crates/egui/src/frame_state.rs b/crates/egui/src/frame_state.rs index 70c558fc498..ebfd0e47be1 100644 --- a/crates/egui/src/frame_state.rs +++ b/crates/egui/src/frame_state.rs @@ -1,6 +1,9 @@ use ahash::{HashMap, HashSet}; -use crate::{id::IdSet, *}; +use crate::{id::IdSet, style, Align, Id, IdMap, LayerId, Rangef, Rect, Vec2, WidgetRects}; + +#[cfg(debug_assertions)] +use crate::{pos2, Align2, Color32, FontId, NumExt, Painter}; /// Reset at the start of each frame. #[derive(Clone, Debug, Default)] @@ -184,12 +187,12 @@ pub struct FrameState { pub tooltips: TooltipFrameState, /// Starts off as the `screen_rect`, shrinks as panels are added. - /// The [`CentralPanel`] does not change this. + /// The [`crate::CentralPanel`] does not change this. /// This is the area available to Window's. pub available_rect: Rect, /// Starts off as the `screen_rect`, shrinks as panels are added. - /// The [`CentralPanel`] retracts from this. + /// The [`crate::CentralPanel`] retracts from this. pub unused_rect: Rect, /// How much space is used by panels. diff --git a/crates/egui/src/grid.rs b/crates/egui/src/grid.rs index e46f2e33949..3b25ca226b8 100644 --- a/crates/egui/src/grid.rs +++ b/crates/egui/src/grid.rs @@ -1,4 +1,10 @@ -use crate::*; +use crate::{ + vec2, Align2, Color32, Context, Id, InnerResponse, NumExt, Painter, Rect, Region, Style, Ui, + UiBuilder, Vec2, +}; + +#[cfg(debug_assertions)] +use crate::Stroke; #[derive(Clone, Debug, Default, PartialEq)] pub(crate) struct State { @@ -382,7 +388,7 @@ impl Grid { } /// Change which row number the grid starts on. - /// This can be useful when you have a large [`Grid`] inside of [`ScrollArea::show_rows`]. + /// This can be useful when you have a large [`crate::Grid`] inside of [`crate::ScrollArea::show_rows`]. #[inline] pub fn start_row(mut self, start_row: usize) -> Self { self.start_row = start_row; diff --git a/crates/egui/src/gui_zoom.rs b/crates/egui/src/gui_zoom.rs index bde60f4321b..4e67d1a1450 100644 --- a/crates/egui/src/gui_zoom.rs +++ b/crates/egui/src/gui_zoom.rs @@ -1,10 +1,10 @@ //! Helpers for zooming the whole GUI of an app (changing [`Context::pixels_per_point`]. //! -use crate::*; +use crate::{Button, Context, Key, KeyboardShortcut, Modifiers, Ui}; /// The suggested keyboard shortcuts for global gui zooming. pub mod kb_shortcuts { - use super::*; + use super::{Key, KeyboardShortcut, Modifiers}; /// Primary keyboard shortcut for zooming in (`Cmd` + `+`). pub const ZOOM_IN: KeyboardShortcut = KeyboardShortcut::new(Modifiers::COMMAND, Key::Plus); diff --git a/crates/egui/src/hit_test.rs b/crates/egui/src/hit_test.rs index 42099d248cc..725eebbac72 100644 --- a/crates/egui/src/hit_test.rs +++ b/crates/egui/src/hit_test.rs @@ -2,7 +2,7 @@ use ahash::HashMap; use emath::TSTransform; -use crate::*; +use crate::{ahash, emath, LayerId, Pos2, WidgetRect, WidgetRects}; /// Result of a hit-test against [`WidgetRects`]. /// @@ -333,6 +333,10 @@ fn find_closest(widgets: impl Iterator, pos: Pos2) -> Option< #[cfg(test)] mod tests { + use emath::{pos2, vec2, Rect}; + + use crate::{Id, Sense}; + use super::*; fn wr(id: Id, sense: Sense, rect: Rect) -> WidgetRect { diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 5749e16825f..9e52031452a 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -1,7 +1,13 @@ mod touch_state; -use crate::data::input::*; -use crate::{emath::*, util::History}; +use crate::data::input::{ + Event, EventFilter, KeyboardShortcut, Modifiers, MouseWheelUnit, PointerButton, RawInput, + TouchDeviceId, ViewportInfo, NUM_POINTER_BUTTONS, +}; +use crate::{ + emath::{vec2, NumExt, Pos2, Rect, Vec2}, + util::History, +}; use std::{ collections::{BTreeMap, HashSet}, time::Duration, diff --git a/crates/egui/src/interaction.rs b/crates/egui/src/interaction.rs index 06b19a0b719..7cbadbf1193 100644 --- a/crates/egui/src/interaction.rs +++ b/crates/egui/src/interaction.rs @@ -1,6 +1,6 @@ //! How mouse and touch interzcts with widgets. -use crate::*; +use crate::{hit_test, id, input_state, memory, Id, InputState, Key, WidgetRects}; use self::{hit_test::WidgetHits, id::IdSet, input_state::PointerEvent, memory::InteractionState}; @@ -28,7 +28,7 @@ pub struct InteractionSnapshot { /// Set the same frame a drag starts, /// but unset the frame a drag ends. /// - /// NOTE: this may not have a corresponding [`WidgetRect`], + /// NOTE: this may not have a corresponding [`crate::WidgetRect`], /// if this for instance is a drag-and-drop widget which /// isn't painted whilst being dragged pub dragged: Option, diff --git a/crates/egui/src/introspection.rs b/crates/egui/src/introspection.rs index 7a4c98c2ba9..7f0ced6ba93 100644 --- a/crates/egui/src/introspection.rs +++ b/crates/egui/src/introspection.rs @@ -1,5 +1,8 @@ //! Showing UI:s for egui/epaint types. -use crate::*; +use crate::{ + epaint, memory, pos2, remap_clamp, vec2, Color32, CursorIcon, FontFamily, FontId, Label, Mesh, + NumExt, Rect, Response, Sense, Shape, Slider, TextStyle, TextWrapMode, Ui, Widget, +}; pub fn font_family_ui(ui: &mut Ui, font_family: &mut FontFamily) { let families = ui.fonts(|f| f.families()); diff --git a/crates/egui/src/layers.rs b/crates/egui/src/layers.rs index 6d5490082de..3a657ba013f 100644 --- a/crates/egui/src/layers.rs +++ b/crates/egui/src/layers.rs @@ -1,7 +1,7 @@ //! Handles paint layers, i.e. how things //! are sometimes painted behind or in front of other things. -use crate::{Id, *}; +use crate::{ahash, epaint, Id, IdMap, Rect}; use epaint::{emath::TSTransform, ClippedShape, Shape}; /// Different layer categories @@ -67,7 +67,7 @@ impl Order { } /// An identifier for a paint layer. -/// Also acts as an identifier for [`Area`]:s. +/// Also acts as an identifier for [`crate::Area`]:s. #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct LayerId { diff --git a/crates/egui/src/layout.rs b/crates/egui/src/layout.rs index a303509de5d..03b3bbd5287 100644 --- a/crates/egui/src/layout.rs +++ b/crates/egui/src/layout.rs @@ -1,4 +1,7 @@ -use crate::{emath::*, Align}; +use crate::{ + emath::{pos2, vec2, Align2, NumExt, Pos2, Rect, Vec2}, + Align, +}; use std::f32::INFINITY; // ---------------------------------------------------------------------------- diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 1df03f0ba8c..eb04e47799b 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -695,4 +695,4 @@ mod profiling_scopes { } #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::{profile_function, profile_scope}; diff --git a/crates/egui/src/load/bytes_loader.rs b/crates/egui/src/load/bytes_loader.rs index d03b2ad418a..9c70f54e1ad 100644 --- a/crates/egui/src/load/bytes_loader.rs +++ b/crates/egui/src/load/bytes_loader.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + generate_loader_id, Bytes, BytesLoadResult, BytesLoader, BytesPoll, Context, Cow, HashMap, + LoadError, Mutex, +}; /// Maps URI:s to [`Bytes`], e.g. found with `include_bytes!`. /// diff --git a/crates/egui/src/load/texture_loader.rs b/crates/egui/src/load/texture_loader.rs index 26c254d4d0b..88533e5d95d 100644 --- a/crates/egui/src/load/texture_loader.rs +++ b/crates/egui/src/load/texture_loader.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + BytesLoader, Context, HashMap, ImagePoll, Mutex, SizeHint, SizedTexture, TextureHandle, + TextureLoadResult, TextureLoader, TextureOptions, TexturePoll, +}; #[derive(Default)] pub struct DefaultTextureLoader { diff --git a/crates/egui/src/memory.rs b/crates/egui/src/memory.rs index 86aa3526799..2a919200976 100644 --- a/crates/egui/src/memory.rs +++ b/crates/egui/src/memory.rs @@ -361,7 +361,7 @@ impl Options { ui.checkbox(reduce_texture_memory, "Reduce texture memory"); }); - use crate::containers::*; + use crate::containers::CollapsingHeader; CollapsingHeader::new("🎑 Style") .default_open(true) .show(ui, |ui| { diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 3801f89b178..1683125d4e9 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -19,7 +19,12 @@ use super::{ style::WidgetVisuals, Align, Context, Id, InnerResponse, PointerState, Pos2, Rect, Response, Sense, TextStyle, Ui, Vec2, }; -use crate::{widgets::*, *}; +use crate::{ + epaint, vec2, + widgets::{Button, ImageButton}, + Align2, Area, Color32, Frame, Key, LayerId, Layout, NumExt, Order, Stroke, Style, TextWrapMode, + UiKind, WidgetText, +}; use epaint::mutex::RwLock; use std::sync::Arc; @@ -77,8 +82,8 @@ fn set_menu_style(style: &mut Style) { style.visuals.widgets.inactive.bg_stroke = Stroke::NONE; } -/// The menu bar goes well in a [`TopBottomPanel::top`], -/// but can also be placed in a [`Window`]. +/// The menu bar goes well in a [`crate::TopBottomPanel::top`], +/// but can also be placed in a [`crate::Window`]. /// In the latter case you may want to wrap it in [`Frame`]. pub fn bar(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse { ui.horizontal(|ui| { diff --git a/crates/egui/src/painter.rs b/crates/egui/src/painter.rs index 8ad0066923a..b173310f756 100644 --- a/crates/egui/src/painter.rs +++ b/crates/egui/src/painter.rs @@ -391,7 +391,7 @@ impl Painter { /// Show an arrow starting at `origin` and going in the direction of `vec`, with the length `vec.length()`. pub fn arrow(&self, origin: Pos2, vec: Vec2, stroke: impl Into) { - use crate::emath::*; + use crate::emath::Rot2; let rot = Rot2::from_angle(std::f32::consts::TAU / 10.0); let tip_length = vec.length() / 4.0; let tip = origin + vec; diff --git a/crates/egui/src/placer.rs b/crates/egui/src/placer.rs index f83076f02c9..3490eef1064 100644 --- a/crates/egui/src/placer.rs +++ b/crates/egui/src/placer.rs @@ -1,7 +1,10 @@ -use crate::*; +use crate::{grid, vec2, Layout, Painter, Pos2, Rect, Region, Vec2}; + +#[cfg(debug_assertions)] +use crate::{Align2, Color32, Stroke}; pub(crate) struct Placer { - /// If set this will take precedence over [`layout`]. + /// If set this will take precedence over [`crate::layout`]. grid: Option, layout: Layout, region: Region, diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index 37895331503..46f391c0216 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -7,8 +7,10 @@ use std::{collections::BTreeMap, ops::RangeInclusive, sync::Arc}; use epaint::{Rounding, Shadow, Stroke}; use crate::{ - ecolor::*, emath::*, ComboBox, CursorIcon, FontFamily, FontId, Grid, Margin, Response, - RichText, TextWrapMode, WidgetText, + ecolor::Color32, + emath::{pos2, vec2, Rangef, Rect, Vec2}, + ComboBox, CursorIcon, FontFamily, FontId, Grid, Margin, Response, RichText, TextWrapMode, + WidgetText, }; /// How to format numbers in e.g. a [`crate::DragValue`]. @@ -361,7 +363,7 @@ pub struct Spacing { /// Default (minimum) width of a [`ComboBox`]. pub combo_width: f32, - /// Default width of a [`TextEdit`]. + /// Default width of a [`crate::TextEdit`]. pub text_edit_width: f32, /// Checkboxes, radio button and collapsing headers have an icon at the start. @@ -887,7 +889,7 @@ pub struct Visuals { pub selection: Selection, - /// The color used for [`Hyperlink`], + /// The color used for [`crate::Hyperlink`], pub hyperlink_color: Color32, /// Something just barely different from the background color. @@ -1489,7 +1491,10 @@ impl Default for Widgets { // ---------------------------------------------------------------------------- -use crate::{widgets::*, Ui}; +use crate::{ + widgets::{reset_button, Button, DragValue, Slider, Widget}, + Ui, +}; impl Style { pub fn ui(&mut self, ui: &mut crate::Ui) { diff --git a/crates/egui/src/text_selection/cursor_range.rs b/crates/egui/src/text_selection/cursor_range.rs index 7a6199834fe..bd3f496fd8e 100644 --- a/crates/egui/src/text_selection/cursor_range.rs +++ b/crates/egui/src/text_selection/cursor_range.rs @@ -1,4 +1,7 @@ -use epaint::{text::cursor::*, Galley}; +use epaint::{ + text::cursor::{CCursor, Cursor, PCursor}, + Galley, +}; use crate::{os::OperatingSystem, Event, Id, Key, Modifiers}; diff --git a/crates/egui/src/text_selection/text_cursor_state.rs b/crates/egui/src/text_selection/text_cursor_state.rs index bd596e7e846..dc75c7dd864 100644 --- a/crates/egui/src/text_selection/text_cursor_state.rs +++ b/crates/egui/src/text_selection/text_cursor_state.rs @@ -1,8 +1,11 @@ //! Text cursor changes/interaction, without modifying the text. -use epaint::text::{cursor::*, Galley}; +use epaint::text::{ + cursor::{CCursor, Cursor}, + Galley, +}; -use crate::*; +use crate::{epaint, NumExt, Pos2, Rect, Response, Ui}; use super::{CCursorRange, CursorRange}; diff --git a/crates/egui/src/text_selection/visuals.rs b/crates/egui/src/text_selection/visuals.rs index 499d501e052..3182b2b9e39 100644 --- a/crates/egui/src/text_selection/visuals.rs +++ b/crates/egui/src/text_selection/visuals.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use crate::*; +use crate::{pos2, vec2, Galley, Painter, Rect, Ui, Visuals}; use super::CursorRange; diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index ca024a9c5e2..8f9454ce45c 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -6,9 +6,29 @@ use std::{any::Any, hash::Hash, sync::Arc}; use epaint::mutex::RwLock; use crate::{ - containers::*, ecolor::*, epaint::text::Fonts, layout::*, menu::MenuState, placer::Placer, - util::IdTypeMap, widgets::*, *, + containers::{CollapsingHeader, CollapsingResponse, Frame}, + ecolor::Hsva, + emath, epaint, + epaint::text::Fonts, + frame_state, grid, + layout::{Direction, Layout}, + menu, + menu::MenuState, + placer::Placer, + pos2, style, + util::IdTypeMap, + vec2, widgets, + widgets::{ + color_picker, Button, Checkbox, DragValue, Hyperlink, Image, ImageSource, Label, Link, + RadioButton, SelectableLabel, Separator, Spinner, TextEdit, Widget, + }, + Align, Color32, Context, CursorIcon, DragAndDrop, Id, InnerResponse, InputState, LayerId, + Memory, Order, Painter, PlatformOutput, Pos2, Rangef, Rect, Response, Rgba, RichText, Sense, + Style, TextStyle, TextWrapMode, UiBuilder, UiStack, UiStackInfo, Vec2, WidgetRect, WidgetText, }; + +#[cfg(debug_assertions)] +use crate::Stroke; // ---------------------------------------------------------------------------- /// This is what you use to place widgets. @@ -78,7 +98,7 @@ impl Ui { /// Create a new top-level [`Ui`]. /// /// Normally you would not use this directly, but instead use - /// [`SidePanel`], [`TopBottomPanel`], [`CentralPanel`], [`Window`] or [`Area`]. + /// [`crate::SidePanel`], [`crate::TopBottomPanel`], [`crate::CentralPanel`], [`crate::Window`] or [`crate::Area`]. pub fn new(ctx: Context, layer_id: LayerId, id: Id, ui_builder: UiBuilder) -> Self { let UiBuilder { id_source, @@ -1275,7 +1295,7 @@ impl Ui { /// # Scrolling impl Ui { - /// Adjust the scroll position of any parent [`ScrollArea`] so that the given [`Rect`] becomes visible. + /// Adjust the scroll position of any parent [`crate::ScrollArea`] so that the given [`Rect`] becomes visible. /// /// If `align` is [`Align::TOP`] it means "put the top of the rect at the top of the scroll area", etc. /// If `align` is `None`, it'll scroll enough to bring the cursor into view. @@ -1314,7 +1334,7 @@ impl Ui { } } - /// Adjust the scroll position of any parent [`ScrollArea`] so that the cursor (where the next widget goes) becomes visible. + /// Adjust the scroll position of any parent [`crate::ScrollArea`] so that the cursor (where the next widget goes) becomes visible. /// /// If `align` is [`Align::TOP`] it means "put the top of the rect at the top of the scroll area", etc. /// If `align` is not provided, it'll scroll enough to bring the cursor into view. @@ -1356,7 +1376,7 @@ impl Ui { } } - /// Scroll this many points in the given direction, in the parent [`ScrollArea`]. + /// Scroll this many points in the given direction, in the parent [`crate::ScrollArea`]. /// /// The delta dictates how the _content_ (i.e. this UI) should move. /// @@ -1366,7 +1386,7 @@ impl Ui { /// A positive Y-value indicates the content is being moved down, /// as when swiping down on a touch-screen or track-pad with natural scrolling. /// - /// If this is called multiple times per frame for the same [`ScrollArea`], the deltas will be summed. + /// If this is called multiple times per frame for the same [`crate::ScrollArea`], the deltas will be summed. /// /// /// See also: [`Response::scroll_to_me`], [`Ui::scroll_to_rect`], [`Ui::scroll_to_cursor`] /// @@ -1935,7 +1955,7 @@ impl Ui { /// # }); /// ``` /// - /// Using [`include_image`] is often the most ergonomic, and the path + /// Using [`crate::include_image`] is often the most ergonomic, and the path /// will be resolved at compile-time and embedded in the binary. /// When using a "file://" url on the other hand, you need to make sure /// the files can be found in the right spot at runtime! diff --git a/crates/egui/src/widget_rect.rs b/crates/egui/src/widget_rect.rs index 76d03270f26..7be3897dcea 100644 --- a/crates/egui/src/widget_rect.rs +++ b/crates/egui/src/widget_rect.rs @@ -1,6 +1,6 @@ use ahash::HashMap; -use crate::*; +use crate::{Id, IdMap, LayerId, Rect, Sense, WidgetInfo}; /// Used to store each widget's [Id], [Rect] and [Sense] each frame. /// @@ -12,9 +12,9 @@ pub struct WidgetRect { /// For interactive widgets, this better be globally unique. /// If not there will be weird bugs, /// and also big red warning test on the screen in debug builds - /// (see [`Options::warn_on_id_clash`]). + /// (see [`crate::Options::warn_on_id_clash`]). /// - /// You can ensure globally unique ids using [`Ui::push_id`]. + /// You can ensure globally unique ids using [`crate::Ui::push_id`]. pub id: Id, /// What layer the widget is on. @@ -44,8 +44,8 @@ pub struct WidgetRect { /// Stores the [`WidgetRect`]s of all widgets generated during a single egui update/frame. /// -/// All [`Ui`]s have a [`WidgetRects`], but whether or not their rects are correct -/// depends on if [`Ui::interact_bg`] was ever called. +/// All [`crate::Ui`]s have a [`WidgetRects`], but whether or not their rects are correct +/// depends on if [`crate::Ui::interact_bg`] was ever called. #[derive(Default, Clone)] pub struct WidgetRects { /// All widgets, in painting order. diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 68753bc0d63..8f12e4e0ace 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + widgets, Align, Color32, Image, NumExt, Rect, Response, Rounding, Sense, Stroke, TextStyle, + TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType, +}; /// Clickable button with text. /// @@ -72,7 +75,7 @@ impl<'a> Button<'a> { /// Set the wrap mode for the text. /// - /// By default, [`Ui::wrap_mode`] will be used, which can be overridden with [`Style::wrap_mode`]. + /// By default, [`crate::Ui::wrap_mode`] will be used, which can be overridden with [`crate::Style::wrap_mode`]. /// /// Note that any `\n` in the text will always produce a new line. #[inline] @@ -157,7 +160,7 @@ impl<'a> Button<'a> { /// /// Designed for menu buttons, for setting a keyboard shortcut text (e.g. `Ctrl+S`). /// - /// The text can be created with [`Context::format_shortcut`]. + /// The text can be created with [`crate::Context::format_shortcut`]. #[inline] pub fn shortcut_text(mut self, shortcut_text: impl Into) -> Self { self.shortcut_text = shortcut_text.into(); diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index e6bef72fc9d..66e9df01f8c 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + epaint, pos2, vec2, NumExt, Response, Sense, Shape, TextStyle, Ui, Vec2, Widget, WidgetInfo, + WidgetText, WidgetType, +}; // TODO(emilk): allow checkbox without a text label /// Boolean on/off control with text label. diff --git a/crates/egui/src/widgets/color_picker.rs b/crates/egui/src/widgets/color_picker.rs index 8943659f923..26575409e56 100644 --- a/crates/egui/src/widgets/color_picker.rs +++ b/crates/egui/src/widgets/color_picker.rs @@ -1,8 +1,14 @@ //! Color picker widgets. use crate::util::fixed_cache::FixedCache; -use crate::*; -use epaint::{ecolor::*, *}; +use crate::{ + epaint, lerp, remap_clamp, Area, Context, DragValue, Frame, Id, Key, Order, Painter, Response, + Sense, Ui, UiKind, Widget, WidgetInfo, WidgetType, +}; +use epaint::{ + ecolor::{Color32, Hsva, HsvaGamma, Rgba}, + pos2, vec2, Mesh, Rect, Shape, Stroke, Vec2, +}; fn contrast_color(color: impl Into) -> Color32 { if color.into().intensity() < 0.5 { diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index 26bbc38cb79..5391c72df9e 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -2,7 +2,10 @@ use std::{cmp::Ordering, ops::RangeInclusive}; -use crate::*; +use crate::{ + emath, text, Button, CursorIcon, Key, Modifiers, NumExt, Response, RichText, Sense, TextEdit, + TextWrapMode, Ui, Widget, WidgetInfo, MINUS_CHAR_STR, +}; // ---------------------------------------------------------------------------- @@ -23,7 +26,7 @@ fn set(get_set_value: &mut GetSetValue<'_>, value: f64) { (get_set_value)(Some(value)); } -/// A numeric value that you can change by dragging the number. More compact than a [`Slider`]. +/// A numeric value that you can change by dragging the number. More compact than a [`crate::Slider`]. /// /// ``` /// # egui::__run_test_ui(|ui| { @@ -90,7 +93,7 @@ impl<'a> DragValue<'a> { /// Sets valid range for the value. /// /// By default all values are clamped to this range, even when not interacted with. - /// You can change this behavior by passing `false` to [`Slider::clamp_to_range`]. + /// You can change this behavior by passing `false` to [`crate::Slider::clamp_to_range`]. #[deprecated = "Use `range` instead"] #[inline] pub fn clamp_range(mut self, range: RangeInclusive) -> Self { @@ -101,7 +104,7 @@ impl<'a> DragValue<'a> { /// Sets valid range for dragging the value. /// /// By default all values are clamped to this range, even when not interacted with. - /// You can change this behavior by passing `false` to [`Slider::clamp_to_range`]. + /// You can change this behavior by passing `false` to [`crate::Slider::clamp_to_range`]. #[inline] pub fn range(mut self, range: RangeInclusive) -> Self { self.range = range.start().to_f64()..=range.end().to_f64(); @@ -176,7 +179,7 @@ impl<'a> DragValue<'a> { /// A custom formatter takes a `f64` for the numeric value and a `RangeInclusive` representing /// the decimal range i.e. minimum and maximum number of decimal places shown. /// - /// The default formatter is [`Style::number_formatter`]. + /// The default formatter is [`crate::Style::number_formatter`]. /// /// See also: [`DragValue::custom_parser`] /// diff --git a/crates/egui/src/widgets/hyperlink.rs b/crates/egui/src/widgets/hyperlink.rs index 59c84227707..55a7b08b8e7 100644 --- a/crates/egui/src/widgets/hyperlink.rs +++ b/crates/egui/src/widgets/hyperlink.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + epaint, text_selection, CursorIcon, Label, Response, Sense, Stroke, Ui, Widget, WidgetInfo, + WidgetText, WidgetType, +}; use self::text_selection::LabelSelectionState; diff --git a/crates/egui/src/widgets/image.rs b/crates/egui/src/widgets/image.rs index bf44d398896..2e1e49671be 100644 --- a/crates/egui/src/widgets/image.rs +++ b/crates/egui/src/widgets/image.rs @@ -5,7 +5,8 @@ use epaint::RectShape; use crate::{ load::{Bytes, SizeHint, SizedTexture, TextureLoadResult, TexturePoll}, - *, + pos2, Align2, Color32, Context, Id, Mesh, Painter, Rect, Response, Rounding, Sense, Shape, + Spinner, Stroke, TextStyle, TextureOptions, Ui, Vec2, Widget, }; /// A widget which displays an image. @@ -13,11 +14,11 @@ use crate::{ /// The task of actually loading the image is deferred to when the `Image` is added to the [`Ui`], /// and how it is loaded depends on the provided [`ImageSource`]: /// -/// - [`ImageSource::Uri`] will load the image using the [asynchronous loading process][`load`]. -/// - [`ImageSource::Bytes`] will also load the image using the [asynchronous loading process][`load`], but with lower latency. +/// - [`ImageSource::Uri`] will load the image using the [asynchronous loading process][`crate::load`]. +/// - [`ImageSource::Bytes`] will also load the image using the [asynchronous loading process][`crate::load`], but with lower latency. /// - [`ImageSource::Texture`] will use the provided texture. /// -/// See [`load`] for more information. +/// See [`crate::load`] for more information. /// /// ### Examples /// // Using it in a layout: @@ -248,7 +249,7 @@ impl<'a> Image<'a> { /// Show a spinner when the image is loading. /// - /// By default this uses the value of [`Visuals::image_loading_spinners`]. + /// By default this uses the value of [`crate::Visuals::image_loading_spinners`]. #[inline] pub fn show_loading_spinner(mut self, show: bool) -> Self { self.show_loading_spinner = Some(show); @@ -519,7 +520,7 @@ pub enum ImageSource<'a> { /// Load the image from an existing texture. /// /// The user is responsible for loading the texture, determining its size, - /// and allocating a [`TextureId`] for it. + /// and allocating a [`crate::TextureId`] for it. Texture(SizedTexture), /// Load the image from some raw bytes. @@ -530,7 +531,7 @@ pub enum ImageSource<'a> { /// /// This instructs the [`Ui`] to cache the raw bytes, which are then further processed by any registered loaders. /// - /// See also [`include_image`] for an easy way to load and display static images. + /// See also [`crate::include_image`] for an easy way to load and display static images. /// /// See [`crate::load`] for more information. Bytes { diff --git a/crates/egui/src/widgets/image_button.rs b/crates/egui/src/widgets/image_button.rs index 79460b456be..4e910eb75dd 100644 --- a/crates/egui/src/widgets/image_button.rs +++ b/crates/egui/src/widgets/image_button.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + widgets, Color32, Image, Rect, Response, Rounding, Sense, Ui, Vec2, Widget, WidgetInfo, + WidgetType, +}; /// A clickable image within a frame. #[must_use = "You should put this widget in an ui with `ui.add(widget);`"] diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index e8d146388d9..23ece9bbea1 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -1,6 +1,9 @@ use std::sync::Arc; -use crate::*; +use crate::{ + epaint, pos2, text_selection, vec2, Align, Direction, FontSelection, Galley, Pos2, Response, + Sense, Stroke, TextWrapMode, Ui, Widget, WidgetInfo, WidgetText, WidgetType, +}; use self::text_selection::LabelSelectionState; @@ -46,7 +49,7 @@ impl Label { /// Set the wrap mode for the text. /// - /// By default, [`Ui::wrap_mode`] will be used, which can be overridden with [`Style::wrap_mode`]. + /// By default, [`crate::Ui::wrap_mode`] will be used, which can be overridden with [`crate::Style::wrap_mode`]. /// /// Note that any `\n` in the text will always produce a new line. #[inline] diff --git a/crates/egui/src/widgets/mod.rs b/crates/egui/src/widgets/mod.rs index 9900117062e..d91efb43d79 100644 --- a/crates/egui/src/widgets/mod.rs +++ b/crates/egui/src/widgets/mod.rs @@ -4,7 +4,7 @@ //! * `ui.add(Label::new("Text").text_color(color::red));` //! * `if ui.add(Button::new("Click me")).clicked() { … }` -use crate::*; +use crate::{epaint, Response, Ui}; mod button; mod checkbox; diff --git a/crates/egui/src/widgets/progress_bar.rs b/crates/egui/src/widgets/progress_bar.rs index 9f1328b7e87..5912700dfea 100644 --- a/crates/egui/src/widgets/progress_bar.rs +++ b/crates/egui/src/widgets/progress_bar.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + lerp, vec2, Color32, NumExt, Pos2, Rect, Response, Rgba, Rounding, Sense, Shape, Stroke, + TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType, +}; enum ProgressBarText { Custom(WidgetText), diff --git a/crates/egui/src/widgets/radio_button.rs b/crates/egui/src/widgets/radio_button.rs index bff620e0a93..35640f8885c 100644 --- a/crates/egui/src/widgets/radio_button.rs +++ b/crates/egui/src/widgets/radio_button.rs @@ -1,4 +1,7 @@ -use crate::*; +use crate::{ + epaint, pos2, vec2, NumExt, Response, Sense, TextStyle, Ui, Vec2, Widget, WidgetInfo, + WidgetText, WidgetType, +}; /// One out of several alternatives, either selected or not. /// diff --git a/crates/egui/src/widgets/selected_label.rs b/crates/egui/src/widgets/selected_label.rs index 037882ac489..21339a73175 100644 --- a/crates/egui/src/widgets/selected_label.rs +++ b/crates/egui/src/widgets/selected_label.rs @@ -1,8 +1,8 @@ -use crate::*; +use crate::{NumExt, Response, Sense, TextStyle, Ui, Widget, WidgetInfo, WidgetText, WidgetType}; /// One out of several alternatives, either selected or not. /// Will mark selected items with a different background color. -/// An alternative to [`RadioButton`] and [`Checkbox`]. +/// An alternative to [`crate::RadioButton`] and [`crate::Checkbox`]. /// /// Usually you'd use [`Ui::selectable_value`] or [`Ui::selectable_label`] instead. /// diff --git a/crates/egui/src/widgets/separator.rs b/crates/egui/src/widgets/separator.rs index f408c6fb0c5..7792bd23950 100644 --- a/crates/egui/src/widgets/separator.rs +++ b/crates/egui/src/widgets/separator.rs @@ -1,6 +1,6 @@ -use crate::*; +use crate::{vec2, Response, Sense, Ui, Vec2, Widget}; -/// A visual separator. A horizontal or vertical line (depending on [`Layout`]). +/// A visual separator. A horizontal or vertical line (depending on [`crate::Layout`]). /// /// Usually you'd use the shorter version [`Ui::separator`]. /// diff --git a/crates/egui/src/widgets/slider.rs b/crates/egui/src/widgets/slider.rs index 74f792e5921..91aa4f1b664 100644 --- a/crates/egui/src/widgets/slider.rs +++ b/crates/egui/src/widgets/slider.rs @@ -2,7 +2,11 @@ use std::ops::RangeInclusive; -use crate::{style::HandleShape, *}; +use crate::{ + emath, epaint, lerp, pos2, remap, remap_clamp, style, style::HandleShape, vec2, Color32, + DragValue, EventFilter, Key, Label, NumExt, Pos2, Rangef, Rect, Response, Sense, TextStyle, + TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, MINUS_CHAR_STR, +}; // ---------------------------------------------------------------------------- @@ -299,10 +303,10 @@ impl<'a> Slider<'a> { /// Display trailing color behind the slider's circle. Default is OFF. /// - /// This setting can be enabled globally for all sliders with [`Visuals::slider_trailing_fill`]. + /// This setting can be enabled globally for all sliders with [`crate::Visuals::slider_trailing_fill`]. /// Toggling it here will override the above setting ONLY for this individual slider. /// - /// The fill color will be taken from `selection.bg_fill` in your [`Visuals`], the same as a [`ProgressBar`]. + /// The fill color will be taken from `selection.bg_fill` in your [`crate::Visuals`], the same as a [`crate::ProgressBar`]. #[inline] pub fn trailing_fill(mut self, trailing_fill: bool) -> Self { self.trailing_fill = Some(trailing_fill); @@ -311,7 +315,7 @@ impl<'a> Slider<'a> { /// Change the shape of the slider handle /// - /// This setting can be enabled globally for all sliders with [`Visuals::handle_shape`]. + /// This setting can be enabled globally for all sliders with [`crate::Visuals::handle_shape`]. /// Changing it here will override the above setting ONLY for this individual slider. #[inline] pub fn handle_shape(mut self, handle_shape: HandleShape) -> Self { @@ -324,7 +328,7 @@ impl<'a> Slider<'a> { /// A custom formatter takes a `f64` for the numeric value and a `RangeInclusive` representing /// the decimal range i.e. minimum and maximum number of decimal places shown. /// - /// The default formatter is [`Style::number_formatter`]. + /// The default formatter is [`crate::Style::number_formatter`]. /// /// See also: [`Slider::custom_parser`] /// diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 00d7d6e3eff..4758ad962c3 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -1,14 +1,18 @@ use std::sync::Arc; -use epaint::text::{cursor::*, Galley, LayoutJob}; +use epaint::text::{cursor::CCursor, Galley, LayoutJob}; use crate::{ + epaint, os::OperatingSystem, output::OutputEvent, + text_selection, text_selection::{ text_cursor_state::cursor_rect, visuals::paint_text_selection, CCursorRange, CursorRange, }, - *, + vec2, Align, Align2, Color32, Context, CursorIcon, Event, EventFilter, FontSelection, Id, + ImeEvent, Key, KeyboardShortcut, Margin, Modifiers, NumExt, Response, Sense, Shape, TextBuffer, + TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetWithState, }; use super::{TextEditOutput, TextEditState}; @@ -55,7 +59,7 @@ use super::{TextEditOutput, TextEditState}; /// See [`TextEdit::show`]. /// /// ## Other -/// The background color of a [`TextEdit`] is [`Visuals::extreme_bg_color`]. +/// The background color of a [`crate::TextEdit`] is [`crate::Visuals::extreme_bg_color`]. #[must_use = "You should put this widget in an ui with `ui.add(widget);`"] pub struct TextEdit<'t> { text: &'t mut dyn TextBuffer, @@ -205,7 +209,7 @@ impl<'t> TextEdit<'t> { self } - /// Pick a [`FontId`] or [`TextStyle`]. + /// Pick a [`crate::FontId`] or [`TextStyle`]. #[inline] pub fn font(mut self, font_selection: impl Into) -> Self { self.font_selection = font_selection.into(); diff --git a/crates/egui/src/widgets/text_edit/state.rs b/crates/egui/src/widgets/text_edit/state.rs index c95d676910a..cef845afcc5 100644 --- a/crates/egui/src/widgets/text_edit/state.rs +++ b/crates/egui/src/widgets/text_edit/state.rs @@ -2,9 +2,10 @@ use std::sync::Arc; use crate::mutex::Mutex; -use crate::*; - -use self::text_selection::{CCursorRange, CursorRange, TextCursorState}; +use crate::{ + text_selection::{CCursorRange, CursorRange, TextCursorState}, + Context, Galley, Id, +}; pub type TextEditUndoer = crate::util::undoer::Undoer<(CCursorRange, String)>; diff --git a/crates/egui_demo_app/src/apps/fractal_clock.rs b/crates/egui_demo_app/src/apps/fractal_clock.rs index 1a6f4f55ebb..3eeddd7beed 100644 --- a/crates/egui_demo_app/src/apps/fractal_clock.rs +++ b/crates/egui_demo_app/src/apps/fractal_clock.rs @@ -1,4 +1,9 @@ -use egui::{containers::*, widgets::*, *}; +use egui::{ + containers::{CollapsingHeader, Frame}, + emath, pos2, + widgets::Slider, + Color32, Painter, Pos2, Rect, Shape, Stroke, Ui, Vec2, +}; use std::f32::consts::TAU; #[derive(PartialEq)] diff --git a/crates/egui_demo_app/src/frame_history.rs b/crates/egui_demo_app/src/frame_history.rs index 8ed150011e1..ddbb2794c03 100644 --- a/crates/egui_demo_app/src/frame_history.rs +++ b/crates/egui_demo_app/src/frame_history.rs @@ -53,7 +53,7 @@ impl FrameHistory { } fn graph(&mut self, ui: &mut egui::Ui) -> egui::Response { - use egui::*; + use egui::{emath, epaint, pos2, vec2, Pos2, Rect, Sense, Shape, Stroke, TextStyle}; ui.label("egui CPU usage history"); diff --git a/crates/egui_demo_app/src/wrap_app.rs b/crates/egui_demo_app/src/wrap_app.rs index 42adf2b857a..13e26f83b45 100644 --- a/crates/egui_demo_app/src/wrap_app.rs +++ b/crates/egui_demo_app/src/wrap_app.rs @@ -428,7 +428,7 @@ impl WrapApp { } fn ui_file_drag_and_drop(&mut self, ctx: &egui::Context) { - use egui::*; + use egui::{Align2, Color32, Id, LayerId, Order, TextStyle}; use std::fmt::Write as _; // Preview hovering files: diff --git a/crates/egui_demo_lib/src/demo/dancing_strings.rs b/crates/egui_demo_lib/src/demo/dancing_strings.rs index 2ba54212167..dd480181dc2 100644 --- a/crates/egui_demo_lib/src/demo/dancing_strings.rs +++ b/crates/egui_demo_lib/src/demo/dancing_strings.rs @@ -1,4 +1,9 @@ -use egui::{containers::*, epaint::PathStroke, *}; +use egui::{ + containers::{Frame, Window}, + emath, epaint, + epaint::PathStroke, + hex_color, lerp, pos2, remap, vec2, Color32, Context, Pos2, Rect, Ui, +}; #[derive(Default)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] diff --git a/crates/egui_demo_lib/src/demo/drag_and_drop.rs b/crates/egui_demo_lib/src/demo/drag_and_drop.rs index 10fd9c859e6..7fa3f01bb50 100644 --- a/crates/egui_demo_lib/src/demo/drag_and_drop.rs +++ b/crates/egui_demo_lib/src/demo/drag_and_drop.rs @@ -1,4 +1,4 @@ -use egui::*; +use egui::{vec2, Color32, Context, Frame, Id, Ui, Window}; #[derive(Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] diff --git a/crates/egui_demo_lib/src/demo/misc_demo_window.rs b/crates/egui_demo_lib/src/demo/misc_demo_window.rs index c45976d2b78..df85a31bf83 100644 --- a/crates/egui_demo_lib/src/demo/misc_demo_window.rs +++ b/crates/egui_demo_lib/src/demo/misc_demo_window.rs @@ -1,6 +1,9 @@ -use super::*; +use super::{Demo, View}; -use egui::*; +use egui::{ + vec2, Align, Checkbox, CollapsingHeader, Color32, Context, FontId, Frame, Resize, RichText, + Sense, Slider, Stroke, TextFormat, TextStyle, Ui, Vec2, Window, +}; /// Showcase some ui code #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] diff --git a/crates/egui_demo_lib/src/demo/paint_bezier.rs b/crates/egui_demo_lib/src/demo/paint_bezier.rs index 7fce1356a57..61dc3b7e676 100644 --- a/crates/egui_demo_lib/src/demo/paint_bezier.rs +++ b/crates/egui_demo_lib/src/demo/paint_bezier.rs @@ -1,5 +1,8 @@ use egui::epaint::{CubicBezierShape, PathShape, QuadraticBezierShape}; -use egui::*; +use egui::{ + emath, epaint, pos2, Color32, Context, Frame, Grid, Pos2, Rect, Sense, Shape, Stroke, Ui, Vec2, + Widget, Window, +}; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", serde(default))] diff --git a/crates/egui_demo_lib/src/demo/painting.rs b/crates/egui_demo_lib/src/demo/painting.rs index 85650f0ed23..8e1df7ae7a2 100644 --- a/crates/egui_demo_lib/src/demo/painting.rs +++ b/crates/egui_demo_lib/src/demo/painting.rs @@ -1,4 +1,4 @@ -use egui::*; +use egui::{emath, vec2, Color32, Context, Frame, Pos2, Rect, Sense, Stroke, Ui, Window}; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", serde(default))] diff --git a/crates/egui_demo_lib/src/demo/pan_zoom.rs b/crates/egui_demo_lib/src/demo/pan_zoom.rs index da1da2c5bfa..f8f4515dffd 100644 --- a/crates/egui_demo_lib/src/demo/pan_zoom.rs +++ b/crates/egui_demo_lib/src/demo/pan_zoom.rs @@ -91,7 +91,7 @@ impl crate::View for PanZoom { ( egui::Pos2::new(60.0, 60.0), Box::new(|ui, state| { - use egui::epaint::*; + use egui::epaint::{pos2, CircleShape, Color32, QuadraticBezierShape, Stroke}; // Smiley face. let painter = ui.painter(); painter.add(CircleShape::filled(pos2(0.0, -10.0), 1.0, Color32::YELLOW)); diff --git a/crates/egui_demo_lib/src/demo/scrolling.rs b/crates/egui_demo_lib/src/demo/scrolling.rs index 7989ca8535e..e970e9d121f 100644 --- a/crates/egui_demo_lib/src/demo/scrolling.rs +++ b/crates/egui_demo_lib/src/demo/scrolling.rs @@ -1,4 +1,7 @@ -use egui::{scroll_area::ScrollBarVisibility, *}; +use egui::{ + pos2, scroll_area::ScrollBarVisibility, Align, Align2, Color32, DragValue, NumExt, Rect, + ScrollArea, Sense, Slider, Style, TextStyle, TextWrapMode, Ui, Vec2, Widget, +}; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[derive(Clone, Copy, Debug, PartialEq)] diff --git a/crates/egui_demo_lib/src/demo/sliders.rs b/crates/egui_demo_lib/src/demo/sliders.rs index 2f3cf7faeda..1d435d4819b 100644 --- a/crates/egui_demo_lib/src/demo/sliders.rs +++ b/crates/egui_demo_lib/src/demo/sliders.rs @@ -1,4 +1,4 @@ -use egui::{style::HandleShape, *}; +use egui::{style::HandleShape, Slider, SliderOrientation, Ui}; use std::f64::INFINITY; /// Showcase sliders diff --git a/crates/egui_demo_lib/src/demo/tests/layout_test.rs b/crates/egui_demo_lib/src/demo/tests/layout_test.rs index bc5e40e5615..f58369121b8 100644 --- a/crates/egui_demo_lib/src/demo/tests/layout_test.rs +++ b/crates/egui_demo_lib/src/demo/tests/layout_test.rs @@ -1,4 +1,4 @@ -use egui::*; +use egui::{vec2, Align, Direction, Layout, Resize, Slider, Ui}; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", serde(default))] diff --git a/crates/egui_demo_lib/src/demo/tests/window_resize_test.rs b/crates/egui_demo_lib/src/demo/tests/window_resize_test.rs index a61540df341..39a189a39fd 100644 --- a/crates/egui_demo_lib/src/demo/tests/window_resize_test.rs +++ b/crates/egui_demo_lib/src/demo/tests/window_resize_test.rs @@ -16,7 +16,7 @@ impl crate::Demo for WindowResizeTest { } fn show(&mut self, ctx: &egui::Context, open: &mut bool) { - use egui::*; + use egui::{Resize, ScrollArea, TextEdit, Window}; Window::new("↔ auto-sized") .open(open) diff --git a/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs b/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs index 0285e60f2e0..7920b97858b 100644 --- a/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs +++ b/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs @@ -1,4 +1,6 @@ -use egui::{text::CCursorRange, *}; +use egui::{ + text::CCursorRange, Key, KeyboardShortcut, Modifiers, ScrollArea, TextBuffer, TextEdit, Ui, +}; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", serde(default))] diff --git a/crates/egui_demo_lib/src/easy_mark/easy_mark_viewer.rs b/crates/egui_demo_lib/src/easy_mark/easy_mark_viewer.rs index 29be2d2ee19..17d3858f7a7 100644 --- a/crates/egui_demo_lib/src/easy_mark/easy_mark_viewer.rs +++ b/crates/egui_demo_lib/src/easy_mark/easy_mark_viewer.rs @@ -1,5 +1,8 @@ use super::easy_mark_parser as easy_mark; -use egui::*; +use egui::{ + vec2, Align, Align2, Hyperlink, Layout, Response, RichText, Sense, Separator, Shape, TextStyle, + Ui, +}; /// Parse and display a VERY simple and small subset of Markdown. pub fn easy_mark(ui: &mut Ui, easy_mark: &str) { diff --git a/crates/egui_demo_lib/src/rendering_test.rs b/crates/egui_demo_lib/src/rendering_test.rs index 54a4cfd5670..f3c788a69e3 100644 --- a/crates/egui_demo_lib/src/rendering_test.rs +++ b/crates/egui_demo_lib/src/rendering_test.rs @@ -1,6 +1,10 @@ use std::collections::HashMap; -use egui::{widgets::color_picker::show_color, TextureOptions, *}; +use egui::{ + epaint, lerp, pos2, vec2, widgets::color_picker::show_color, Align2, Color32, FontId, Image, + Mesh, Pos2, Rect, Response, Rgba, RichText, Sense, Shape, Stroke, TextureHandle, + TextureOptions, Ui, Vec2, +}; const GRADIENT_SIZE: Vec2 = vec2(256.0, 18.0); @@ -265,7 +269,6 @@ impl ColorTest { } fn vertex_gradient(ui: &mut Ui, bg_fill: Color32, gradient: &Gradient) -> Response { - use egui::epaint::*; let (rect, response) = ui.allocate_at_least(GRADIENT_SIZE, Sense::hover()); if bg_fill != Default::default() { let mut mesh = Mesh::default(); diff --git a/crates/egui_extras/src/lib.rs b/crates/egui_extras/src/lib.rs index 381242c90b5..ab2dde735b9 100644 --- a/crates/egui_extras/src/lib.rs +++ b/crates/egui_extras/src/lib.rs @@ -63,7 +63,7 @@ mod profiling_scopes { } #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::profile_function; // --------------------------------------------------------------------------- diff --git a/crates/egui_glow/src/lib.rs b/crates/egui_glow/src/lib.rs index cfb95acd3d7..0e1a98102af 100644 --- a/crates/egui_glow/src/lib.rs +++ b/crates/egui_glow/src/lib.rs @@ -139,4 +139,4 @@ mod profiling_scopes { } #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::{profile_function, profile_scope}; diff --git a/crates/emath/src/align.rs b/crates/emath/src/align.rs index 8cc515836cb..71f17244157 100644 --- a/crates/emath/src/align.rs +++ b/crates/emath/src/align.rs @@ -1,6 +1,6 @@ //! One- and two-dimensional alignment ([`Align::Center`], [`Align2::LEFT_TOP`] etc). -use crate::*; +use crate::{pos2, vec2, Pos2, Rangef, Rect, Vec2}; /// left/center/right or top/center/bottom alignment for e.g. anchors and layouts. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] diff --git a/crates/emath/src/ordered_float.rs b/crates/emath/src/ordered_float.rs index 950ec16ac2c..0b8014d90b1 100644 --- a/crates/emath/src/ordered_float.rs +++ b/crates/emath/src/ordered_float.rs @@ -101,7 +101,7 @@ impl Float for f64 { // Keep this trait in private module, to avoid exposing its methods as extensions in user code mod private { - use super::*; + use super::{Hash, Hasher}; pub trait FloatImpl { fn is_nan(&self) -> bool; diff --git a/crates/emath/src/pos2.rs b/crates/emath/src/pos2.rs index 2f3d1bd1b26..1f4bd86427f 100644 --- a/crates/emath/src/pos2.rs +++ b/crates/emath/src/pos2.rs @@ -1,7 +1,7 @@ use std::fmt; use std::ops::{Add, AddAssign, Sub, SubAssign}; -use crate::*; +use crate::{lerp, Div, Mul, Vec2}; /// A position on screen. /// diff --git a/crates/emath/src/rect.rs b/crates/emath/src/rect.rs index c3e6ad934c1..800093ec3b7 100644 --- a/crates/emath/src/rect.rs +++ b/crates/emath/src/rect.rs @@ -1,7 +1,7 @@ use std::f32::INFINITY; use std::fmt; -use crate::*; +use crate::{lerp, pos2, vec2, Div, Mul, Pos2, Rangef, Rot2, Vec2}; /// A rectangular region of space. /// diff --git a/crates/epaint/benches/benchmark.rs b/crates/epaint/benches/benchmark.rs index 6323137fa50..07a743ae404 100644 --- a/crates/epaint/benches/benchmark.rs +++ b/crates/epaint/benches/benchmark.rs @@ -1,6 +1,9 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use epaint::{tessellator::Path, *}; +use epaint::{ + pos2, tessellator::Path, ClippedShape, Color32, Mesh, PathStroke, Pos2, Rect, Shape, Stroke, + TessellationOptions, Tessellator, TextureAtlas, Vec2, +}; fn single_dashed_lines(c: &mut Criterion) { c.bench_function("single_dashed_lines", move |b| { diff --git a/crates/epaint/src/bezier.rs b/crates/epaint/src/bezier.rs index a48c161ca97..7c55352cfeb 100644 --- a/crates/epaint/src/bezier.rs +++ b/crates/epaint/src/bezier.rs @@ -4,7 +4,7 @@ use std::ops::Range; use crate::{shape::Shape, Color32, PathShape, PathStroke}; -use emath::*; +use emath::{Pos2, Rect, RectTransform}; // ---------------------------------------------------------------------------- @@ -762,6 +762,8 @@ fn cubic_for_each_local_extremum(p0: f32, p1: f32, p2: f32, p3: f #[cfg(test)] mod tests { + use emath::pos2; + use super::*; #[test] diff --git a/crates/epaint/src/lib.rs b/crates/epaint/src/lib.rs index 25c445e1504..42f78531e88 100644 --- a/crates/epaint/src/lib.rs +++ b/crates/epaint/src/lib.rs @@ -171,4 +171,4 @@ mod profiling_scopes { } #[allow(unused_imports)] -pub(crate) use profiling_scopes::*; +pub(crate) use profiling_scopes::{profile_function, profile_scope}; diff --git a/crates/epaint/src/mesh.rs b/crates/epaint/src/mesh.rs index 2e626df6b79..10b724b9045 100644 --- a/crates/epaint/src/mesh.rs +++ b/crates/epaint/src/mesh.rs @@ -1,5 +1,5 @@ -use crate::*; -use emath::*; +use crate::{emath, Color32, TextureId, WHITE_UV}; +use emath::{Pos2, Rect, Rot2, TSTransform, Vec2}; /// The 2D vertex type. /// diff --git a/crates/epaint/src/shadow.rs b/crates/epaint/src/shadow.rs index fc7de267b9a..ea6454f99cf 100644 --- a/crates/epaint/src/shadow.rs +++ b/crates/epaint/src/shadow.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Color32, Margin, Rect, RectShape, Rounding, Vec2}; /// The color and fuzziness of a fuzzy shape. /// diff --git a/crates/epaint/src/shape.rs b/crates/epaint/src/shape.rs index 70f9a8b5cfd..d69a832efb4 100644 --- a/crates/epaint/src/shape.rs +++ b/crates/epaint/src/shape.rs @@ -7,7 +7,7 @@ use crate::{ text::{FontId, Fonts, Galley}, Color32, Mesh, Stroke, TextureId, }; -use emath::*; +use emath::{pos2, Align2, Pos2, Rangef, Rect, TSTransform, Vec2}; pub use crate::{CubicBezierShape, QuadraticBezierShape}; diff --git a/crates/epaint/src/shape_transform.rs b/crates/epaint/src/shape_transform.rs index 3e976768d3f..f072393f557 100644 --- a/crates/epaint/src/shape_transform.rs +++ b/crates/epaint/src/shape_transform.rs @@ -1,6 +1,9 @@ use std::sync::Arc; -use crate::*; +use crate::{ + color, CircleShape, Color32, ColorMode, CubicBezierShape, EllipseShape, Mesh, PathShape, + QuadraticBezierShape, RectShape, Shape, TextShape, +}; /// Remember to handle [`Color32::PLACEHOLDER`] specially! pub fn adjust_colors( diff --git a/crates/epaint/src/stats.rs b/crates/epaint/src/stats.rs index c63d5a0ddec..68bba622ed2 100644 --- a/crates/epaint/src/stats.rs +++ b/crates/epaint/src/stats.rs @@ -1,6 +1,6 @@ //! Collect statistics about what is being painted. -use crate::*; +use crate::{ClippedShape, Galley, Mesh, Primitive, Shape}; /// Size of the elements in a vector/array. #[derive(Clone, Copy, PartialEq)] diff --git a/crates/epaint/src/stroke.rs b/crates/epaint/src/stroke.rs index 36ecac253d3..f1155bd07d6 100644 --- a/crates/epaint/src/stroke.rs +++ b/crates/epaint/src/stroke.rs @@ -2,7 +2,7 @@ use std::{fmt::Debug, sync::Arc}; -use super::*; +use super::{emath, Color32, ColorMode, Pos2, Rect}; /// Describes the width and color of a line. /// diff --git a/crates/epaint/src/tessellator.rs b/crates/epaint/src/tessellator.rs index 71a4b780515..6ee1a11a53d 100644 --- a/crates/epaint/src/tessellator.rs +++ b/crates/epaint/src/tessellator.rs @@ -6,8 +6,12 @@ #![allow(clippy::identity_op)] use crate::texture_atlas::PreparedDisc; -use crate::*; -use emath::*; +use crate::{ + color, emath, stroke, CircleShape, ClippedPrimitive, ClippedShape, Color32, CubicBezierShape, + EllipseShape, Mesh, PathShape, Primitive, QuadraticBezierShape, RectShape, Rounding, Shape, + Stroke, TextShape, TextureId, Vertex, WHITE_UV, +}; +use emath::{pos2, remap, vec2, NumExt, Pos2, Rect, Rot2, Vec2}; use self::color::ColorMode; use self::stroke::PathStroke; @@ -338,7 +342,7 @@ impl Path { } pub fn add_circle(&mut self, center: Pos2, radius: f32) { - use precomputed_vertices::*; + use precomputed_vertices::{CIRCLE_128, CIRCLE_16, CIRCLE_32, CIRCLE_64, CIRCLE_8}; // These cutoffs are based on a high-dpi display. TODO(emilk): use pixels_per_point here? // same cutoffs as in add_circle_quadrant @@ -520,7 +524,7 @@ impl Path { pub mod path { //! Helpers for constructing paths use crate::shape::Rounding; - use emath::*; + use emath::{pos2, Pos2, Rect}; /// overwrites existing points pub fn rounded_rectangle(path: &mut Vec, rect: Rect, rounding: Rounding) { @@ -589,7 +593,7 @@ pub mod path { // - quadrant 3: right top // * angle 4 * TAU / 4 = right pub fn add_circle_quadrant(path: &mut Vec, center: Pos2, radius: f32, quadrant: f32) { - use super::precomputed_vertices::*; + use super::precomputed_vertices::{CIRCLE_128, CIRCLE_16, CIRCLE_32, CIRCLE_64, CIRCLE_8}; // These cutoffs are based on a high-dpi display. TODO(emilk): use pixels_per_point here? // same cutoffs as in add_circle @@ -1171,7 +1175,7 @@ pub struct Tessellator { options: TessellationOptions, font_tex_size: [usize; 2], - /// See [`TextureAtlas::prepared_discs`]. + /// See [`crate::TextureAtlas::prepared_discs`]. prepared_discs: Vec, /// size of feathering in points. normally the size of a physical pixel. 0.0 if disabled @@ -1191,7 +1195,7 @@ impl Tessellator { /// * `options`: tessellation quality /// * `shapes`: what to tessellate /// * `font_tex_size`: size of the font texture. Required to normalize glyph uv rectangles when tessellating text. - /// * `prepared_discs`: What [`TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec. + /// * `prepared_discs`: What [`crate::TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec. pub fn new( pixels_per_point: f32, options: TessellationOptions, @@ -1902,7 +1906,7 @@ impl Tessellator { /// * `options`: tessellation quality /// * `shapes`: what to tessellate /// * `font_tex_size`: size of the font texture. Required to normalize glyph uv rectangles when tessellating text. - /// * `prepared_discs`: What [`TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec. + /// * `prepared_discs`: What [`crate::TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec. /// /// The implementation uses a [`Tessellator`]. /// diff --git a/crates/epaint/src/text/font.rs b/crates/epaint/src/text/font.rs index 7520c971a89..5a119cdc1f8 100644 --- a/crates/epaint/src/text/font.rs +++ b/crates/epaint/src/text/font.rs @@ -92,7 +92,7 @@ impl FontImpl { assert!(scale_in_pixels > 0.0); assert!(pixels_per_point > 0.0); - use ab_glyph::*; + use ab_glyph::{Font, ScaleFont}; let scaled = ab_glyph_font.as_scaled(scale_in_pixels); let ascent = scaled.ascent() / pixels_per_point; let descent = scaled.descent() / pixels_per_point; diff --git a/crates/epaint/src/text/text_layout.rs b/crates/epaint/src/text/text_layout.rs index 87be7cd0076..d8f59381f91 100644 --- a/crates/epaint/src/text/text_layout.rs +++ b/crates/epaint/src/text/text_layout.rs @@ -1,7 +1,7 @@ use std::ops::RangeInclusive; use std::sync::Arc; -use emath::*; +use emath::{pos2, vec2, Align, NumExt, Pos2, Rect, Vec2}; use crate::{stroke::PathStroke, text::font::Font, Color32, Mesh, Stroke, Vertex}; diff --git a/crates/epaint/src/text/text_layout_types.rs b/crates/epaint/src/text/text_layout_types.rs index 108a2c2fb1a..c754061b5f2 100644 --- a/crates/epaint/src/text/text_layout_types.rs +++ b/crates/epaint/src/text/text_layout_types.rs @@ -4,9 +4,12 @@ use std::ops::Range; use std::sync::Arc; -use super::{cursor::*, font::UvRect}; +use super::{ + cursor::{CCursor, Cursor, PCursor, RCursor}, + font::UvRect, +}; use crate::{Color32, FontId, Mesh, Stroke}; -use emath::*; +use emath::{pos2, vec2, Align, NumExt, OrderedFloat, Pos2, Rect, Vec2}; /// Describes the task of laying out text. /// diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index bdf1fa63eca..49e280a5a8b 100644 --- a/examples/custom_window_frame/src/main.rs +++ b/examples/custom_window_frame/src/main.rs @@ -43,7 +43,7 @@ impl eframe::App for MyApp { } fn custom_window_frame(ctx: &egui::Context, title: &str, add_contents: impl FnOnce(&mut egui::Ui)) { - use egui::*; + use egui::{CentralPanel, UiBuilder}; let panel_frame = egui::Frame { fill: ctx.style().visuals.window_fill(), @@ -77,7 +77,7 @@ fn custom_window_frame(ctx: &egui::Context, title: &str, add_contents: impl FnOn } fn title_bar_ui(ui: &mut egui::Ui, title_bar_rect: eframe::epaint::Rect, title: &str) { - use egui::*; + use egui::{vec2, Align2, FontId, Id, PointerButton, Sense, UiBuilder}; let painter = ui.painter(); diff --git a/examples/file_dialog/src/main.rs b/examples/file_dialog/src/main.rs index 63874649b66..ac4f05251b1 100644 --- a/examples/file_dialog/src/main.rs +++ b/examples/file_dialog/src/main.rs @@ -86,7 +86,7 @@ impl eframe::App for MyApp { /// Preview hovering files: fn preview_files_being_dropped(ctx: &egui::Context) { - use egui::*; + use egui::{Align2, Color32, Id, LayerId, Order, TextStyle}; use std::fmt::Write as _; if !ctx.input(|i| i.raw.hovered_files.is_empty()) { diff --git a/examples/keyboard_events/src/main.rs b/examples/keyboard_events/src/main.rs index b5dc9006ee1..4ea0994340b 100644 --- a/examples/keyboard_events/src/main.rs +++ b/examples/keyboard_events/src/main.rs @@ -2,7 +2,7 @@ #![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; -use egui::*; +use egui::{Key, ScrollArea}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). diff --git a/examples/popups/src/main.rs b/examples/popups/src/main.rs index 761f6406b8f..46762d667c0 100644 --- a/examples/popups/src/main.rs +++ b/examples/popups/src/main.rs @@ -1,7 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui::*; +use eframe::egui::{popup_below_widget, CentralPanel, ComboBox, Id, PopupCloseBehavior}; fn main() -> Result<(), eframe::Error> { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). diff --git a/scripts/check.sh b/scripts/check.sh index a7108fa0a20..072c2ea542d 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -9,7 +9,7 @@ set -x # Checks all tests, lints etc. # Basically does what the CI does. -cargo +1.75.0 install --quiet typos-cli +cargo +1.76.0 install --quiet typos-cli export RUSTFLAGS="-D warnings" export RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454 @@ -20,8 +20,9 @@ typos cargo fmt --all -- --check cargo doc --quiet --lib --no-deps --all-features cargo doc --quiet --document-private-items --no-deps --all-features - cargo clippy --quiet --all-targets --all-features -- -D warnings +cargo clippy --all-targets --all-features --release -- -D warnings # we need to check release mode too + ./scripts/clippy_wasm.sh cargo check --quiet --all-targets