* Rename `CursorPair` to `CursorRange`
* Easymark editor: add keyboard shortcuts to toggle bold, italics etc
* Split up TextEdit into separate files
* Add TextEdit::show that returns a rich TextEditOutput object with response, galley and cursor
* Rename text_edit::State to TextEditState
This refactors the widget state storage introduced by @optozorax in https://github.com/emilk/egui/pull/257
* Unify the four buckets (`data`, `data_temp`, `id_data` and `id_data_temp`) into a single `data`.
* Less complexity, and also less chance of error (storing in one bucket, reading from another).
* Store data by `Id` and `TypeId`.
* Users can thus reuse the same `Id` to store many types.
* Uses a simple xor of id and typeid, which is fast and good since both id and typeid are already high-entropy hashes.
* Use different suffixes on the functions to pick if you want the data persisted or not (`get_temp`, `insert_persisted`, etc).
* Writing with one suffix and reading with the other works.
* To store state not bound to a specific `Id` (i.e. only based on type), use the new `Id::null` as the key.
* Make egui_glow and opt-in backend for eframe
* Add egui_glow to Cargo.toml and to CI
* Reference egui_glow where egui_glium is mentioned
* Remove path-patches from root Cargo.toml
* Add instructions on how to enable the glow backend of eframe
* Rename epaint feature "persistence" to "serialize"
* Add separate "serialize" feature to egui
* egui_demo_lib: separate serialize and persistence features
* Add App::persist_native_window and App::persist_egui_memory
Controls what gets persisted
Label text will now be centered, right-aligned and/or
justified based on the layout.
Galleys are no longer always pivoted in the left top corner,
so now have a Rect rather than just a size.
This PR introduces a completely rewritten text layout engine which is simpler and more powerful. It allows mixing different text styles (heading, body, etc) and formats (color, underlining, strikethrough, …) in the same layout pass, and baked into the same `Galley`.
This opens up the door to having a syntax-highlighed code editor, or a WYSIWYG markdown editor.
One major change is the color is now baked in at layout time. However, many widgets changes text color on hovered. But we need to do the text layout before we know if it is hovered. Therefor the painter has an option to override the text color of a galley.
## Performance
Text layout alone is about 20% slower, but a lot of that is because more tessellation is done upfront. Text tessellation is now a lot faster, but text layout + tessellation still lands at a net loss of 5-10% in performance. There are however a few tricks to speed it up (like using `smallvec`) which I am saving for later. Text layout is also cached, meaning that in most cases (when all text isn't changing each frame) text tessellation is actually more important (and that's more than 2x faster!).
Sadly, the actual text cache lookup is significantly slower (300ns -> 600ns). That's because the `TextLayoutJob` is a lot bigger (it has more options, like underlining, fonts etc), so it is slower to hash and compare. I have an idea how to speed this up, but I need to do some other work before I can implement that.
All in all, the performance impact on `demo_with_tesselate__realistic` is about 5-6% in the red. Not great; not terrible. The benefits are worth it, but I also think with some work I can get that down significantly, hopefully down to the old levels.
* First pass (missing rendering the bar)
* Render horizontal bars, and change Window scroll API
* emath: add impl Index + IndexMut for Align2
* Scrolling: fix subtle sizing bugs
* Add horizontal scrolling to color test
* try to wrap content before showing scrollbars, + add auto-shrink option
* Add hscroll to the misc demo window
* Fix for putting wrapping labels in an infinitely wide layout
* Add a egui_asserts to protect against nans in the layout engine
* Add line about horizontal scrolling to changelog
* Add example to docs of ScrollArea
* code cleanup
* Fix incorrect max_width/height of panels
* Fix set_width/set_min_width/set_height/set_min_height
Closes https://github.com/emilk/egui/issues/647
Broke in https://github.com/emilk/egui/pull/629
* Fix expand_to_include_x/expand_to_include_y
* Make minimum grid column width propagate properly
* Expand cursor when max_rect expands
* Add ui.expand_to_include_y
* Only expand cursor in advance
* demo: clean up font_book code
* Fix: Make sure `TextEdit` contents expand to fill width if applicable
* ProgressBar: minimum width and fix for having it in an infinite layout
* clippy fix
* Add methods for optionally displaying the background/axes of a `Plot`
These are particularly useful when using the `Plot` widget as an overlay
over an existing grid or some other content.
* Allow for showing each axis of a `Plot` individually
* Fix case where `Plot`'s `min_auto_bounds` can be ignored after first
I ran into an issue using `Plot` within my timeline widget where if I
zoom in and out of the timeline (not the plot), the `Plot` instances
would ignore the necessary changes to the `include_x` calls and in turn
would become skewed and misaligned with the timeline below.
This changes the `Plot` to check whether or not `min_auto_bounds` have
changed and, if so, reset the memory and recalculate the bounds.
See #562 for an image of my current use case.
* Carry hidden_items when updating plot for changed bounds