Commit Graph
54 Commits
Author SHA1 Message Date
Nathan Sobo d4b20491fb WIP: Start on List::layout
Perform layout on any elements that we haven't yet laid out.
2021-08-21 13:40:45 -06:00
Nathan Sobo 174ead146a Remove after_layout from Element trait
Now that layout takes a MutableAppContext we don't need an after_layout phase.
2021-08-20 16:40:45 -06:00
Nathan Sobo 2f5f0a4f96 WIP 2021-08-20 16:34:46 -06:00
Nathan Sobo 9f69d8ce2b WIP: Move sum_tree module into gpui so we can use it in List 2021-08-20 16:18:39 -06:00
Max BrunsfeldandNathan Sobo 662e76d3bc Get new theme structure working
* Fix precedence of extends directives
* Always group color with font properties for text theming

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-04 14:07:19 -07:00
Max Brunsfeld 03bcb5fa11 Restructure Theme with new style objects 2021-08-03 13:36:58 -07:00
Max BrunsfeldandNathan Sobo 51d1664122 Use custom color wrapper type everywhere in gpui & zed
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-03 12:48:58 -07:00
Max BrunsfeldandNathan Sobo 9f279062db Extract {Container,Label}Style structs from those elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-03 11:07:03 -07:00
Max BrunsfeldandNathan Sobo 5532f60e2f Add a theme picker
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 14:55:27 -07:00
Max Brunsfeld 85fdc91e47 Extract most colors in codebase into theme file. switch to dark 2021-07-30 09:50:28 -07:00
eb1cfd8db3 Pass a MutableAppContext to Element::layout and ::dispatch_event
We need to mutate the app in these cases to relay layout state, so this just makes things easier. We won't be able to perform layout in parallel but it's questionable whether we'll ever actually do that. If we do, we can revisit.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-23 10:52:08 -06:00
Max Brunsfeld 5203f8af1c Rename context parameters to cx in gpui 2021-05-28 15:32:35 -07:00
Max BrunsfeldandNathan Sobo a82d25e5dd Rename foo/mod.rs files too foo.rs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 14:41:58 -07:00
Nathan Sobo d72dc9ff6a Fix test assertions 2021-05-21 14:36:52 -06:00
Nathan Sobo 6a078c3281 Accept colors in styling runs passed to layout_str
Also move from the runs being expressed as ranges to the runs being expressed as a sequence of contiguous scalar lengths.
2021-05-21 14:10:38 -06:00
Antonio Scandurra 4e845a3003 Complete unit test for Label highlights 2021-05-20 12:47:08 +02:00
Max Brunsfeld 53867f6620 WIP - Adjust Label element to expect highlights as byte offsets 2021-05-20 12:47:08 +02:00
Max Brunsfeld 853c50a2d2 Adjust layout_str to use byte coordinates
* Interpret ranges as byte ranges for incoming runs
* Return glyphs whose indices are byte offsets
2021-05-20 12:47:08 +02:00
Nathan SoboandAntonio Scandurra a620be4434 Close tabs when X is clicked
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-04-28 10:00:45 -06:00
Nathan Sobo 5da9755007 WIP 2021-04-27 18:35:24 -06:00
Nathan SoboandMax Brunsfeld be6859003a Render a close tab button on tab hover
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-04-27 11:58:59 -06:00
Nathan SoboandMax Brunsfeld fa92bd1893 Relay hover events to tabs
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-04-27 11:37:14 -06:00
Nathan SoboandAntonio Scandurra e0bb313d67 Capture hover events on tabs
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-04-27 09:23:44 -06:00
Nathan Sobo 26185a24d6 Introduce MouseEventHandler
Still need to give elements the ability to re-render their parent view. Once that is in place, I think we can implement hoverable close tab buttons.
2021-04-26 21:52:18 -06:00
Max BrunsfeldandNathan Sobo 766f9b6d60 Cancel outstanding fuzzy-matching calls before starting a new one
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-26 16:14:43 -07:00
Max BrunsfeldandNathan Sobo ac56309f00 Fix scrollwheel events in uniformlist
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-26 15:53:38 -07:00
Max BrunsfeldandNathan Sobo f281528de5 Improve styling of tabs
* Enforce a min width per tab
* Center the title within tab, regardless of icon
* Render icon over the top of the tab title
* Ensure there is always a fixed minimum amount of filler to the right of all tabs

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-14 15:14:46 -07:00
Max BrunsfeldandNathan Sobo 889ea4cedc Avoid setting constrain min to infinity in Flex layout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-14 15:14:46 -07:00
Max BrunsfeldandNathan Sobo 77924d6631 Include constraints in element tree JSON debug output
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-14 15:14:46 -07:00
Nathan Sobo 5220ebaed2 Order debug JSON and allow elements to be named; copy to clipboard 2021-04-07 21:54:14 -06:00
Nathan Sobo a2f3d0cfba Add ability to debug element trees as JSON 2021-04-07 21:54:14 -06:00
Max Brunsfeld 511e444015 Throw a little between filename and modified icon
We probably need a primitive to right-align an element within
its parent, but I don't have strong opinions about how that
should be designed, so I'm just adding this as a temporary
measure so that the tabs won't look too ugly in the meantime.
2021-04-07 15:39:09 -07:00
Max Brunsfeld ecd5698f4a Start work on displaying modified status in tabs 2021-04-06 14:37:21 -07:00
Max BrunsfeldandNathan Sobo 4e93a56e29 Vertically center linebox child element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-06 13:03:19 -07:00
Antonio Scandurra d2e30bc457 Implement SVG rendering 2021-04-06 13:46:33 +02:00
Nathan Sobo 00af25da17 Inset container contents to account for container border 2021-04-01 10:31:00 -06:00
Antonio Scandurra 7a052566a5 Don't render glyphs located outside of BufferElement's bounds 2021-04-01 11:19:50 +02:00
Antonio ScandurraandNathan Sobo 2a616e984a Remove Overdraw
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-03-31 17:58:43 +02:00
Antonio ScandurraandNathan Sobo ba5640aba5 Fix tabs layout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-03-31 17:57:00 +02:00
Antonio Scandurra 61d4da9934 Introduce layer clipping 2021-03-26 10:28:05 +01:00
Antonio Scandurra 5439213199 Fix Empty sometimes returning an infinite size in layout
This commit also ensures that elements never report an infinite size by
adding a debug assertion in the `Lifecycle` element.
2021-03-26 09:46:53 +01:00
Antonio Scandurra 1cb987d489 Remove stray use of pathfinder_geometry 2021-03-25 18:19:20 +01:00
Antonio Scandurra 0f6927eb4b Re-export font_kit primitives from a new fonts module
...also, rename the old `fonts` to `font_cache`.
2021-03-25 10:58:33 +01:00
Antonio ScandurraandNathan Sobo 9178e91cc0 Extract platform-dependant FontSystem
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-03-24 16:51:28 +01:00
Antonio Scandurra 43abd96769 Apply padding correctly when painting Container's children 2021-03-23 10:59:35 +01:00
Nathan Sobo 66dcb73263 Respect margins when painting Container 2021-03-22 21:11:08 -06:00
Antonio ScandurraandNathan Sobo 859c0f53cb WIP: Introduce layers in renderer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-03-22 18:55:53 +01:00
Antonio ScandurraandNathan Sobo bfc57cb4f6 Start on rendering shadows
This still doesn't work properly because shadows are rendered beneath
quads and we still don't have a layering mechanism.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-03-22 18:05:16 +01:00
Nathan Sobo 119aa452b6 Overhaul the entire element system
Now the Element trait is designed to be wrapped in a Lifecycle enum that gets placed inside an ElementBox. This allows the framework to store data on behalf of the Element implementation, such as sizes, bounds, and also implementation-specific LayoutState and PaintState types. This makes it easier to reason about which data is available in each Element method.
2021-03-21 20:54:23 -06:00
Nathan SoboandAntonio Scandurra 046fe3fff9 Dispatch keystrokes and fix rerendering when window invalidated
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-03-21 11:38:23 -06:00