Commit Graph

39 Commits

Author SHA1 Message Date
Dzmitry Malyshau
ce84a2a671 linux: refactor window structure, support move callback 2024-02-01 21:43:28 -08:00
Marshall Bowers
2980f0508c
Rework loading images from files (#7088)
This PR is a follow-up to #7084, where I noted that I wasn't satisfied
with using `SharedUri` to represent both URIs and paths on the local
filesystem:

> I'm still not entirely happy with this naming, as the file paths that
we can store in here are not _really_ URIs, as they are lacking a
protocol.
>
> I want to explore changing `SharedUri` / `SharedUrl` back to alway
storing a URL and treat local filepaths differently, as it seems we're
conflating two different concerns under the same umbrella, at the
moment.

`SharedUri` has now been reverted to just containing a `SharedString`
with a URI.

`ImageSource` now has a new `File` variant that is used to load an image
from a `PathBuf`.

Release Notes:

- N/A
2024-01-30 11:26:02 -05:00
Marshall Bowers
6c7893db35
Rename SharedUrl to SharedUri (#7084)
This PR renames `SharedUrl` to `SharedUri` to better reflect its intent.

I'm still not entirely happy with this naming, as the file paths that we
can store in here are not _really_ URIs, as they are lacking a protocol.

I want to explore changing `SharedUri` / `SharedUrl` back to alway
storing a URL and treat local filepaths differently, as it seems we're
conflating two different concerns under the same umbrella, at the
moment.

Release Notes:

- N/A
2024-01-30 09:54:23 -05:00
Bennet Bo Fenner
dd74643993
gpui: Support loading image from filesystem (#6978)
This PR implements support for loading and displaying images from a
local file using gpui's `img` element.

API Changes:
- Changed `SharedUrl` to `SharedUrl::File`, `SharedUrl::Network`

Usage:
```rust
// load from network
img(SharedUrl::network(...)) // previously img(SharedUrl(...)

// load from filesystem
img(SharedUrl::file(...))
```

This will be useful when implementing markdown image support, because we
need to be able to render images from the filesystem (relative/absolute
path), e.g. when implementing markdown preview #5064.

I also added an example `image` to the gpui crate, let me know if this
is useful. Showcase:
<img width="872" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/b4310a26-db81-44fa-9a7b-61e7d0ad4349">

**Note**: The example is fetching images from [Lorem
Picsum](https://picsum.photos) ([Github
Repo](https://github.com/DMarby/picsum-photos)), which is a free
resource for fetching images in a specific size. Please let me know if
you're okay with using this in the example.
2024-01-29 21:56:51 -08:00
Sean Aye
5fcc75be1f
gpui: Add hello world example (#6465)
Added hello world example to the gpui crate copied from https://gpui.rs

Release Notes:

- N/A
2024-01-25 01:03:53 -05:00
Nathan Sobo
f9165938b0 More adjustments for blog post 2024-01-18 07:01:46 -07:00
Nathan Sobo
bef1b83265 Add ownership post example 2024-01-17 21:19:28 -07:00
Max Brunsfeld
f5ba22659b Remove 2 suffix from gpui
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:59:39 -08:00
Nathan Sobo
e0fdc7d0aa Eliminate PaintContext 2023-09-11 09:00:59 -06:00
Nathan Sobo
a24d94cfda Eliminate LayoutContext 2023-09-11 08:47:00 -06:00
Nathan Sobo
ebf8b32811 Checkpoint 2023-09-08 16:25:10 -06:00
Mikayla
707ca34f19
Merge branch 'main' into disclosable-component 2023-08-23 16:30:27 -07:00
Nathan Sobo
d375f7992d Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
Mikayla
e946b0a2ec
Finish building out adapters and names
Document core traits
Add start for a component storybook
2023-08-19 14:40:05 -07:00
Mikayla
bd3ab82dac
Add disclosable components into channels
Rename components to more closely match their purpose
2023-08-19 05:18:53 -07:00
Mikayla
2d37128693
Actually get it compiling, omg 2023-08-18 19:02:27 -07:00
Mikayla
8ef671d7a1
Move the collab panel to the left by default
Increase the indent size on channels
Switch font UI mono
2023-08-18 15:04:22 -07:00
Mikayla
7d3ffae47d
move component into gpui 2023-08-15 15:44:59 -07:00
Max Brunsfeld
3623a9ca5e Simplify Component implementation
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-15 15:26:02 -07:00
Mikayla
e5eed29c72
Add components example
Re-arrange generics on mouse event handler
Add TypeTag struct for dynamically tagged components
2023-08-15 03:06:43 -07:00
Nathan Sobo
740b105330 Merge branch 'main' into taffy
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-08-14 13:50:21 -06:00
Nathan Sobo
fa7ebd0825 Include drop shadows with different corner radii in the example 2023-08-12 11:08:58 -06:00
Nathan Sobo
84dc4090bd Wire up per corner radii for quad
Still need to expose this in the styling layer and allow images
to have per corner radii.
2023-08-12 10:40:23 -06:00
Nathan Sobo
0374bc66ce WIP 2023-07-26 12:54:23 -06:00
Max Brunsfeld
8eb9c6563a Generalize Text element to let you add arbitrary scene primitives for runs of text 2023-04-27 13:58:06 -07:00
Max Brunsfeld
1bbcff543b Add API for adding mouse regions within Text 2023-04-26 12:00:26 -07:00
Nathan Sobo
fe492eacbf Refine naming of element-related types and traits
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-21 13:06:37 -06:00
Antonio Scandurra
03619dfa55 Rename Drawable::boxed to into_element and make containers generic
Multi-element are now generic over any drawable child, which can be converted
into an element.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-04-21 12:43:19 -06:00
Nathan Sobo
a25f962185 WIP 2023-04-12 12:13:35 -06:00
Nathan Sobo
e115baa60c WIP 2023-04-11 18:21:56 -06:00
Antonio Scandurra
4d915f4530 Don't make fonts::Features Copy 2023-03-17 13:54:56 +01:00
Antonio Scandurra
b2c733baab WIP: Allow specifying font features in the editor
This just lays the foundation for threading through a `fonts::Features`
struct, but it's not used yet.
2023-03-17 09:51:36 +01:00
Nathan Sobo
12eab6551f Remove dispatch_event from Element trait 2022-10-16 13:08:25 -06:00
ForLoveOfCats
8ba2f77148 One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Antonio Scandurra
97ce3998ec Position IME input according to where the selection is rendered 2022-07-21 17:35:40 +02:00
Antonio Scandurra
73f2fd6b09 Pass visible bounds to Element::dispatch_event 2022-04-07 15:10:09 +02:00
Antonio Scandurra
fbf7cdf4f2 Make all HighlightStyle properties optional
Previously, some of those properties such the font weight, style and color
would be mandatory: when the theme didn't specify them, Zed would use a default
value during deserialization. This meant that those default properties would
unconditionally override the base text style, causing a rendering bug when
combining syntax highlights with diagnostic styles.

This commit fixes that by making `HighlightStyle`s more additive: each property
can be set independently and only the properties that theme specifies get
overridden in the base text style.
2022-03-15 10:39:43 +01:00
Max Brunsfeld
4069db4959 Allow underlines to have different color than the text
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 12:46:46 -07:00
Nathan Sobo
fdfed3d7db Move all crates to a top-level crates folder
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-10-04 13:22:21 -06:00