This commit is contained in:
Nathan Sobo 2023-04-12 12:10:43 -06:00
parent 40896352ff
commit a25f962185
90 changed files with 587 additions and 501 deletions

View file

@ -68,7 +68,7 @@ impl View for CollabTitlebarItem {
"CollabTitlebarItem"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
let workspace = if let Some(workspace) = self.workspace.upgrade(cx) {
workspace
} else {
@ -326,7 +326,7 @@ impl CollabTitlebarItem {
&self,
theme: &Theme,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let titlebar = &theme.workspace.titlebar;
let badge = if self
@ -391,7 +391,7 @@ impl CollabTitlebarItem {
theme: &Theme,
room: &ModelHandle<Room>,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let icon;
let tooltip;
if room.read(cx).is_screen_sharing() {
@ -437,7 +437,7 @@ impl CollabTitlebarItem {
workspace: &ViewHandle<Workspace>,
theme: &Theme,
cx: &mut ViewContext<Self>,
) -> Option<ElementBox<Self>> {
) -> Option<Element<Self>> {
let project = workspace.read(cx).project();
if project.read(cx).is_remote() {
return None;
@ -491,11 +491,7 @@ impl CollabTitlebarItem {
)
}
fn render_user_menu_button(
&self,
theme: &Theme,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
fn render_user_menu_button(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> Element<Self> {
let titlebar = &theme.workspace.titlebar;
Stack::new()
@ -539,7 +535,7 @@ impl CollabTitlebarItem {
.boxed()
}
fn render_sign_in_button(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render_sign_in_button(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> Element<Self> {
let titlebar = &theme.workspace.titlebar;
MouseEventHandler::<SignIn, Self>::new(0, cx, |state, _| {
let style = titlebar.sign_in_prompt.style_for(state, false);
@ -559,7 +555,7 @@ impl CollabTitlebarItem {
&'a self,
_theme: &'a theme::Titlebar,
cx: &'a ViewContext<Self>,
) -> Option<ElementBox<Self>> {
) -> Option<Element<Self>> {
self.contacts_popover.as_ref().map(|popover| {
Overlay::new(ChildView::new(popover, cx).boxed())
.with_fit_mode(OverlayFitMode::SwitchAnchor)
@ -578,7 +574,7 @@ impl CollabTitlebarItem {
theme: &Theme,
room: &ModelHandle<Room>,
cx: &mut ViewContext<Self>,
) -> Vec<ElementBox<Self>> {
) -> Vec<Element<Self>> {
let mut participants = room
.read(cx)
.remote_participants()
@ -620,7 +616,7 @@ impl CollabTitlebarItem {
user: &Arc<User>,
peer_id: PeerId,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let replica_id = workspace.read(cx).project().read(cx).replica_id();
Container::new(self.render_face_pile(
user,
@ -644,7 +640,7 @@ impl CollabTitlebarItem {
workspace: &ViewHandle<Workspace>,
theme: &Theme,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let project_id = workspace.read(cx).project().read(cx).remote_id();
let room = ActiveCall::global(cx).read(cx).room();
let is_being_followed = workspace.read(cx).is_being_followed(peer_id);
@ -824,11 +820,11 @@ impl CollabTitlebarItem {
style
}
fn render_face(
fn render_face<V: View>(
avatar: Arc<ImageData>,
avatar_style: AvatarStyle,
background_color: Color,
) -> ElementBox<Self> {
) -> Element<V> {
Image::from_data(avatar)
.with_style(avatar_style.image)
.aligned()
@ -846,7 +842,7 @@ impl CollabTitlebarItem {
&self,
status: &client::Status,
cx: &mut ViewContext<Self>,
) -> Option<ElementBox<Self>> {
) -> Option<Element<Self>> {
enum ConnectionStatusButton {}
let theme = &cx.global::<Settings>().theme.clone();
@ -903,7 +899,7 @@ impl AvatarRibbon {
}
}
impl Element<CollabTitlebarItem> for AvatarRibbon {
impl Drawable<CollabTitlebarItem> for AvatarRibbon {
type LayoutState = ();
type PaintState = ();

View file

@ -30,7 +30,7 @@ impl View for CollaboratorListPopover {
"CollaboratorListPopover"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
let theme = cx.global::<Settings>().theme.clone();
MouseEventHandler::<Self, Self>::new(0, cx, |_, _| {
@ -117,7 +117,7 @@ fn render_collaborator_list_entry<UA: Action + Clone, IA: Action + Clone>(
icon_action: IA,
icon_tooltip: String,
cx: &mut ViewContext<CollaboratorListPopover>,
) -> ElementBox<CollaboratorListPopover> {
) -> Element<CollaboratorListPopover> {
enum Username {}
enum UsernameTooltip {}
enum Icon {}

View file

@ -32,7 +32,7 @@ impl View for ContactFinder {
"ContactFinder"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
ChildView::new(&self.picker, cx).boxed()
}
@ -104,7 +104,7 @@ impl PickerDelegate for ContactFinder {
mouse_state: &mut MouseState,
selected: bool,
cx: &gpui::AppContext,
) -> ElementBox<Picker<Self>> {
) -> Element<Picker<Self>> {
let theme = &cx.global::<Settings>().theme;
let user = &self.potential_contacts[ix];
let request_status = self.user_store.read(cx).contact_request_status(user);

View file

@ -748,7 +748,7 @@ impl ContactList {
is_pending: bool,
is_selected: bool,
theme: &theme::ContactList,
) -> ElementBox<Self> {
) -> Element<Self> {
Flex::row()
.with_children(user.avatar.clone().map(|avatar| {
Image::from_data(avatar)
@ -800,7 +800,7 @@ impl ContactList {
is_selected: bool,
theme: &theme::ContactList,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let font_cache = cx.font_cache();
let host_avatar_height = theme
.contact_avatar
@ -899,7 +899,7 @@ impl ContactList {
is_selected: bool,
theme: &theme::ContactList,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let font_cache = cx.font_cache();
let host_avatar_height = theme
.contact_avatar
@ -1000,7 +1000,7 @@ impl ContactList {
is_selected: bool,
is_collapsed: bool,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
enum Header {}
enum LeaveCallContactList {}
@ -1078,7 +1078,7 @@ impl ContactList {
theme: &theme::ContactList,
is_selected: bool,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
let online = contact.online;
let busy = contact.busy || calling;
let user_id = contact.user.id;
@ -1195,7 +1195,7 @@ impl ContactList {
is_incoming: bool,
is_selected: bool,
cx: &mut ViewContext<Self>,
) -> ElementBox<Self> {
) -> Element<Self> {
enum Decline {}
enum Accept {}
enum Cancel {}
@ -1331,7 +1331,7 @@ impl View for ContactList {
cx
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
enum AddContact {}
let theme = cx.global::<Settings>().theme.clone();
@ -1387,7 +1387,7 @@ impl View for ContactList {
}
}
fn render_icon_button(style: &IconButton, svg_path: &'static str) -> impl Element<ContactList> {
fn render_icon_button(style: &IconButton, svg_path: &'static str) -> impl Drawable<ContactList> {
Svg::new(svg_path)
.with_color(style.color)
.constrained()

View file

@ -42,7 +42,7 @@ impl View for ContactNotification {
"ContactNotification"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
match self.kind {
ContactEventKind::Requested => render_user_notification(
self.user.clone(),

View file

@ -91,7 +91,7 @@ impl View for ContactsPopover {
"ContactsPopover"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
let theme = cx.global::<Settings>().theme.clone();
let child = match &self.child {
Child::ContactList(child) => ChildView::new(child, cx),

View file

@ -7,14 +7,14 @@ use gpui::{
},
json::ToJson,
serde_json::{self, json},
Axis, Element, ElementBox, SceneBuilder, ViewContext,
Axis, Drawable, Element, SceneBuilder, ViewContext,
};
use crate::CollabTitlebarItem;
pub(crate) struct FacePile {
overlap: f32,
faces: Vec<ElementBox<CollabTitlebarItem>>,
faces: Vec<Element<CollabTitlebarItem>>,
}
impl FacePile {
@ -26,7 +26,7 @@ impl FacePile {
}
}
impl Element<CollabTitlebarItem> for FacePile {
impl Drawable<CollabTitlebarItem> for FacePile {
type LayoutState = ();
type PaintState = ();
@ -101,8 +101,8 @@ impl Element<CollabTitlebarItem> for FacePile {
}
}
impl Extend<ElementBox<CollabTitlebarItem>> for FacePile {
fn extend<T: IntoIterator<Item = ElementBox<CollabTitlebarItem>>>(&mut self, children: T) {
impl Extend<Element<CollabTitlebarItem>> for FacePile {
fn extend<T: IntoIterator<Item = Element<CollabTitlebarItem>>>(&mut self, children: T) {
self.faces.extend(children);
}
}

View file

@ -6,7 +6,7 @@ use gpui::{
geometry::{rect::RectF, vector::vec2f},
impl_internal_actions,
platform::{CursorStyle, MouseButton, WindowBounds, WindowKind, WindowOptions},
AppContext, ElementBox, Entity, View, ViewContext,
AppContext, Element, Entity, View, ViewContext,
};
use settings::Settings;
use util::ResultExt;
@ -99,7 +99,7 @@ impl IncomingCallNotification {
}
}
fn render_caller(&self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render_caller(&self, cx: &mut ViewContext<Self>) -> Element<Self> {
let theme = &cx.global::<Settings>().theme.incoming_call_notification;
let default_project = proto::ParticipantProject::default();
let initial_project = self
@ -165,7 +165,7 @@ impl IncomingCallNotification {
.boxed()
}
fn render_buttons(&self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render_buttons(&self, cx: &mut ViewContext<Self>) -> Element<Self> {
enum Accept {}
enum Decline {}
@ -222,7 +222,7 @@ impl View for IncomingCallNotification {
"IncomingCallNotification"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
let background = cx
.global::<Settings>()
.theme

View file

@ -2,7 +2,7 @@ use client::User;
use gpui::{
elements::*,
platform::{CursorStyle, MouseButton},
Action, Element, ElementBox, View, ViewContext,
Action, Drawable, Element, View, ViewContext,
};
use settings::Settings;
use std::sync::Arc;
@ -17,7 +17,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
dismiss_action: A,
buttons: Vec<(&'static str, Box<dyn Action>)>,
cx: &mut ViewContext<V>,
) -> ElementBox<V> {
) -> Element<V> {
let theme = cx.global::<Settings>().theme.clone();
let theme = &theme.contact_notification;

View file

@ -104,7 +104,7 @@ impl ProjectSharedNotification {
cx.remove_window(window_id);
}
fn render_owner(&self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render_owner(&self, cx: &mut ViewContext<Self>) -> Element<Self> {
let theme = &cx.global::<Settings>().theme.project_shared_notification;
Flex::row()
.with_children(self.owner.avatar.clone().map(|avatar| {
@ -164,7 +164,7 @@ impl ProjectSharedNotification {
.boxed()
}
fn render_buttons(&self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render_buttons(&self, cx: &mut ViewContext<Self>) -> Element<Self> {
enum Open {}
enum Dismiss {}
@ -227,7 +227,7 @@ impl View for ProjectSharedNotification {
"ProjectSharedNotification"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> gpui::ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> gpui::Element<Self> {
let background = cx
.global::<Settings>()
.theme

View file

@ -3,7 +3,7 @@ use gpui::{
color::Color,
elements::{MouseEventHandler, Svg},
platform::{Appearance, MouseButton},
AppContext, Element, ElementBox, Entity, View, ViewContext,
AppContext, Drawable, Element, Entity, View, ViewContext,
};
use settings::Settings;
@ -40,7 +40,7 @@ impl View for SharingStatusIndicator {
"SharingStatusIndicator"
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> ElementBox<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
let color = match cx.window_appearance() {
Appearance::Light | Appearance::VibrantLight => Color::black(),
Appearance::Dark | Appearance::VibrantDark => Color::white(),