Commit Graph

1036 Commits

Author SHA1 Message Date
Stanisław Jelnicki 2745699bd6
Add `Ui::spinner` shortcut method (#1494) 2022-04-15 07:39:08 +02:00
tami5 b738418243
New example 'custom_font_style' + improve docs (#1476) 2022-04-14 07:54:01 +02:00
Emil Ernerfeldt a7b6334784 Misc doc improvements 2022-04-13 22:14:34 +02:00
Emil Ernerfeldt 2ae93c40ab
Move examples out of `eframe/examples` into `examples/` (#1486)
* Move examples out of eframe/examples into examples/

Give each example a `Cargo.toml` and `src/main.rs`.
This makes it easier for people to use as templates.

* Update README.md with more deps needed on vanilla Ubuntu
* Install libgtk-3-dev on CI, hoping that will fix something
2022-04-13 16:13:24 +02:00
Emil Ernerfeldt 170b21b63e
Add opt-in support for the 'puffin' profiler in eframe (#1483) 2022-04-13 11:06:13 +02:00
Emil Ernerfeldt 038b3cf2e2 Add `Painter::hline` and `Painter::vline` 2022-04-12 10:54:38 +02:00
Emil Ernerfeldt 701ae3cb46 egui_extras::Table: fix bugs in the virtual scrolling 2022-04-11 17:54:57 +02:00
Emil Ernerfeldt 0e0eedfdda Add ui.horizontal_centered 2022-04-11 10:28:45 +02:00
Emil Ernerfeldt 29d214912f Improve explanation of immediate mode
Closes https://github.com/emilk/egui/issues/1465
2022-04-10 09:43:23 +02:00
Emil Ernerfeldt cf0338d48f
Rust 1.60.0 + refactor cargo features (#1467)
* Update to rust 1.60.0
* Rename the feature `convert_bytemuck` to `bytemuck`
* Rename the feature `serialize` to `serde`.
* Make use of the "weak dependency" cargo feature
* Set rust-version = "1.60" for all crates
* egui_glow: clipboard, links, persistence & winit are now opt-in features
2022-04-09 13:54:47 +02:00
Friz64 dd58d5175f
Replace `top_most_layer` with more flexible `layer_ids` (#1266) 2022-04-08 09:06:04 +02:00
Emil Ernerfeldt 7cd285ecbc misc clippy fixes from 1.60.0 2022-04-07 17:03:19 +02:00
Zachary Kohnen dffab1c737
Add Shape::galley_with_color (#1461) 2022-04-06 18:47:46 +02:00
Emil Ernerfeldt a9ae8c3e2c
Smaller checkboxes and radiobutton without a label (#1456)
Co-authored-by: Michael Völkl <michaelvoelkl@zoho.com>
2022-04-05 09:16:58 +02:00
Emil Ernerfeldt c3b6d1bab9
Warn about Id clashes for Grid, Plot, ScrollArea, Table (#1452)
Id clashes can cause subtle bugs.

egui already warns when the same Id is used to interact with different
parts of the screen.

This adds warnings about id clashes for some widgets that store state:
Grid, Plot, ScrollArea, Table.

The PR also adds `Context::check_for_id_clash` so users who create
their own widgets can add the same type of check.
2022-04-04 13:13:34 +02:00
Emil Ernerfeldt 5d19f381f9 Fix TexEdit clipping half the cursor when in the first column
Closes https://github.com/emilk/egui/issues/1449
2022-04-04 09:20:19 +02:00
Emil Ernerfeldt dfd6a91cb0 Fix doclinks 2022-04-03 20:38:51 +02:00
awaken1ng 901b7c7994
[epaint] Add more text wrapping options (#1291) 2022-04-03 20:28:47 +02:00
Emil Ernerfeldt d09fa63d9c Fix `Ui::add_visible` sometimes leaving the `Ui` in a disabled state
Closes https://github.com/emilk/egui/issues/1436
2022-04-03 19:38:34 +02:00
4JX 6091370962
Add more doc-links in docstrings (#1419) 2022-04-03 18:18:35 +02:00
Lucas Kent c2039920de
Add Plot::allow_scroll (#1382) 2022-04-03 10:43:55 +02:00
Emil Ernerfeldt 21c32a18d8
Table resize (#1438)
* Let 1D strips fill up parent width/height
* Add Strip + Table + DatePicker to egui_extras changelog
* Expose some dragging- and pointer related context/memory methods
* Make tables resizable
2022-04-01 12:01:00 +02:00
René Rössler 1d32670cf3
Dynamic sized strips, tables, and date picker (#963) 2022-03-31 21:13:25 +02:00
Emil Ernerfeldt 8f178fa4e0
Add glow::Context to epi::Frame (#1425)
This can be used, for instance, to:

* Render things to offscreen buffers.
* Read the pixel buffer from the previous frame (glow::Context::read_pixels).
* Render things behind the egui windows.
2022-03-27 15:20:45 +02:00
Anna Clemens bc0fdefceb
Expose ui.cursor and ui.next_widget_position (#1342) 2022-03-25 19:34:03 +01:00
4JX dd9699099f
Add `ComboBox::icon()` (#1405) 2022-03-23 21:56:46 +01:00
Emil Ernerfeldt 8272b08742
Improve text contrast in bright mode (#1412)
* Rename AlphaImage to FontImage to discourage any other use for it
* Encode FontImage as f32 and postpone the alpha correction
* Interpret alpha coverage in a new, making dark text darker, improving contrast in bright mode
2022-03-23 16:49:49 +01:00
Emil Ernerfeldt 1387d6e9d6
Refactor TessellationOptions to expose slider for feathering size (#1408)
The epaint tessellator uses "feathering" to accomplish anti-aliasing. This PS allows you to control the feathering size, i.e. how blurry the edges of epaint shapes are.

This changes the interface of Tessellator slightly, and renames some options in TessellationOptions.
2022-03-23 11:41:38 +01:00
Emil Ernerfeldt ea9393aa9b
glow painter improvements (#1406)
* Add viewport info to PaintCallback
* glow: be more explicit with more state
* glow: Refactor VAO
2022-03-22 23:11:27 +01:00
Edgeworth e5aeb1618f
Export the PlotBounds type. (#1392) 2022-03-22 08:59:13 +01:00
Hunter522 0a400a5bcc
Add Image::rotate and Mesh::rotate (#1371)
Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
2022-03-22 08:44:23 +01:00
Emil Ernerfeldt 15254f8235
Remove the single_threaded/multi_threaded feature flags (#1390)
Always use parking_lot for mutexes, i.e. always be multi-threaded.

Closes #1379
2022-03-21 22:20:37 +01:00
Emil Ernerfeldt 339b28b470 Add Frame::outer_margin, and rename Frame::margin to Frame::inner_margin 2022-03-21 21:44:52 +01:00
Emil Ernerfeldt fda8189cba
Move lints list to `.carg/config.toml` (#1394)
That way they apply to all crates equally.

See https://github.com/EmbarkStudios/rust-ecosystem/issues/22 for why.
2022-03-21 16:54:29 +01:00
Emil Ernerfeldt ccbddcfe95 Add example of how to move text cursor in a TextEdit 2022-03-20 23:08:19 +01:00
Emil Ernerfeldt fde9c232b3 Improve the introspection paint stats 2022-03-20 23:05:16 +01:00
Emil Ernerfeldt d20be45c4c Add egui_assert to ensure texture size is <= max_texture_side 2022-03-20 22:49:44 +01:00
Zachary Kohnen 8bb381d50b
Fix code that could lead to a possible deadlock. (#1380)
* Fix code that could lead to a possible deadlock.

Drop implementations are not called until the end of a statement. The statement changed in this commit therefore took 4 read locks on a RwLock which can lead to problems if a write lock is requested between any of these read locks. The code looks like it would only hold one lock at a time but it does not drop any of the locks until after the arithmatic operations complete, which leads to this situation. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=996079046184329f3a9df1cd19c87da8 to see this in action. The fix is to just take one lock and share it between the three calls to num_presses, letting it drop at the end of the scope.

* Fix code that may cause a deadlock in `MenuRoot::stationary_interaction`

The issue here is related to that in 9673b8f2a08302c10ffcfd063f2dbdec4301d3e2 in that the lock is not dropped when it is expected.  Since the `RwLockReadGuard` produced by `ctx.input()` has a reference taken from it (one into `pointer`), the lock cannot be dropped until that reference is no longre valid, which is the end of the scope (in this case this function).  The following `ctx.input()` then attempts to aquire a second lock on the `RwLock`, creating the same situation that was found in the referenced commit.

This has been resolved by holding one lock on the input for the whole function.

* Reference this PR from comments in the code for future maintainers

* Add the change to the changelog

* Use full link to PR

* Use full link to PR

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-03-20 20:30:38 +01:00
Emil Ernerfeldt 12c31e980b
Add Ui::push_id (#1374) 2022-03-19 13:30:43 +01:00
zam-5 cecb48af03
Added plot_ui::plot_clicked() (#1372) 2022-03-19 13:00:18 +01:00
Emil Ernerfeldt c8f6cae362
eframe app creation refactor (#1363)
* Change how eframe apps are created
* eframe: re-export epi::* so users don't need to care about what epi is
2022-03-16 15:39:48 +01:00
Emil Ernerfeldt c768d1d48e
Context::request_repaint will wake up the UI thread (#1366)
This adds a callback (set by `Context::set_request_repaint_callback`)
which integration can use to wake up the UI thread.

eframe (egui_web and egui_glow) will use this, replacing
`epi::Frame::request_repaint`.

Existing code calling `epi::Frame::request_repaint` should be changed
to instead call `egui::Context::request_repaint`.

This is the first callback added to the egui API, which otherwise is
completely driven by data.

The purpose of this is to remove the confusion between the two
`request_repaint` methods (by removing one). Furthermore, it makes
`epi::Frame` a lot simpler, allowing future simplifications to it
(perhaps no longer having it be `Send+Sync+Clone`).
2022-03-15 17:21:52 +01:00
Emil Ernerfeldt 6aee4997d4
Add Shape::Callback to do custom rendering inside of an egui UI (#1351)
* Add Shape::Callback to do custom rendering inside of an egui UI
* Use Rc<glow::Context> everywhere
* Remove trait WebPainter
* Add glow::Context to epi::App::setup
2022-03-14 13:25:11 +01:00
Emil Ernerfeldt 002158050b
Add Frame::canvas - bright in bright mode, dark in dark mode (#1362)
and use it in the demo app
2022-03-14 12:33:17 +01:00
Emil Ernerfeldt 510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00
Simon Gardling c19a7ff34f
remove unnecessary to_string in docs (#1345) 2022-03-10 08:23:00 +01:00
Zachary Kohnen 5d950e1c15
[egui_web] Prevent event handlers from running if code has panicked (#1306)
Closes: #1290

Fix panic reported by @Titaniumtown
See https://github.com/emilk/egui/pull/1306#issuecomment-1060775376
2022-03-10 08:13:32 +01:00
Simon Gardling 0e7a4fdbfd
Add method to set a Plot's margin (#1308) 2022-03-08 15:50:53 +01:00
Juan Campa e3d1fa22d1
Fix combo box misalignment on rtl layout (#1304) 2022-03-07 10:48:12 +01:00
Emil Ernerfeldt a05520b9d3 Release 0.17.0 - Improved font selection and image handling 2022-02-22 19:32:30 +01:00