Merge remote-tracking branch 'origin/main' into chat-again
This commit is contained in:
commit
fe6f0a253b
164 changed files with 7012 additions and 3586 deletions
|
@ -12,7 +12,7 @@ use gpui::{
|
|||
ViewContext, ViewHandle,
|
||||
};
|
||||
use project::Project;
|
||||
use std::any::Any;
|
||||
use std::any::{Any, TypeId};
|
||||
use workspace::{
|
||||
item::{FollowableItem, Item, ItemHandle},
|
||||
register_followable_item,
|
||||
|
@ -186,6 +186,21 @@ impl View for ChannelView {
|
|||
}
|
||||
|
||||
impl Item for ChannelView {
|
||||
fn act_as_type<'a>(
|
||||
&'a self,
|
||||
type_id: TypeId,
|
||||
self_handle: &'a ViewHandle<Self>,
|
||||
_: &'a AppContext,
|
||||
) -> Option<&'a AnyViewHandle> {
|
||||
if type_id == TypeId::of::<Self>() {
|
||||
Some(self_handle)
|
||||
} else if type_id == TypeId::of::<Editor>() {
|
||||
Some(&self.editor)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn tab_content<V: 'static>(
|
||||
&self,
|
||||
_: Option<usize>,
|
||||
|
|
|
@ -2536,14 +2536,14 @@ fn render_tree_branch(
|
|||
let cap_height = row_style.cap_height(font_cache);
|
||||
let baseline_offset = row_style.baseline_offset(font_cache) + (size.y() - line_height) / 2.;
|
||||
|
||||
Canvas::new(move |scene, bounds, _, _, _| {
|
||||
scene.paint_layer(None, |scene| {
|
||||
Canvas::new(move |bounds, _, _, cx| {
|
||||
cx.paint_layer(None, |cx| {
|
||||
let start_x = bounds.min_x() + (bounds.width() / 2.) - (branch_style.width / 2.);
|
||||
let end_x = bounds.max_x();
|
||||
let start_y = bounds.min_y();
|
||||
let end_y = bounds.min_y() + baseline_offset - (cap_height / 2.);
|
||||
|
||||
scene.push_quad(gpui::Quad {
|
||||
cx.scene().push_quad(gpui::Quad {
|
||||
bounds: RectF::from_points(
|
||||
vec2f(start_x, start_y),
|
||||
vec2f(
|
||||
|
@ -2555,7 +2555,7 @@ fn render_tree_branch(
|
|||
border: gpui::Border::default(),
|
||||
corner_radii: (0.).into(),
|
||||
});
|
||||
scene.push_quad(gpui::Quad {
|
||||
cx.scene().push_quad(gpui::Quad {
|
||||
bounds: RectF::from_points(
|
||||
vec2f(start_x, end_y),
|
||||
vec2f(end_x, end_y + branch_style.width),
|
||||
|
|
|
@ -13,8 +13,8 @@ use gpui::{
|
|||
geometry::{rect::RectF, vector::vec2f, PathBuilder},
|
||||
json::{self, ToJson},
|
||||
platform::{CursorStyle, MouseButton},
|
||||
AppContext, Entity, ImageData, LayoutContext, ModelHandle, PaintContext, SceneBuilder,
|
||||
Subscription, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
AppContext, Entity, ImageData, ModelHandle, Subscription, View, ViewContext, ViewHandle,
|
||||
WeakViewHandle,
|
||||
};
|
||||
use picker::PickerEvent;
|
||||
use project::{Project, RepositoryEntry};
|
||||
|
@ -771,7 +771,7 @@ impl CollabTitlebarItem {
|
|||
})
|
||||
.with_tooltip::<ToggleUserMenu>(
|
||||
0,
|
||||
"Toggle user menu".to_owned(),
|
||||
"Toggle User Menu".to_owned(),
|
||||
Some(Box::new(ToggleUserMenu)),
|
||||
tooltip,
|
||||
cx,
|
||||
|
@ -1165,19 +1165,18 @@ impl Element<CollabTitlebarItem> for AvatarRibbon {
|
|||
&mut self,
|
||||
constraint: gpui::SizeConstraint,
|
||||
_: &mut CollabTitlebarItem,
|
||||
_: &mut LayoutContext<CollabTitlebarItem>,
|
||||
_: &mut ViewContext<CollabTitlebarItem>,
|
||||
) -> (gpui::geometry::vector::Vector2F, Self::LayoutState) {
|
||||
(constraint.max, ())
|
||||
}
|
||||
|
||||
fn paint(
|
||||
&mut self,
|
||||
scene: &mut SceneBuilder,
|
||||
bounds: RectF,
|
||||
_: RectF,
|
||||
_: &mut Self::LayoutState,
|
||||
_: &mut CollabTitlebarItem,
|
||||
_: &mut PaintContext<CollabTitlebarItem>,
|
||||
cx: &mut ViewContext<CollabTitlebarItem>,
|
||||
) -> Self::PaintState {
|
||||
let mut path = PathBuilder::new();
|
||||
path.reset(bounds.lower_left());
|
||||
|
@ -1188,7 +1187,7 @@ impl Element<CollabTitlebarItem> for AvatarRibbon {
|
|||
path.line_to(bounds.upper_right() - vec2f(bounds.height(), 0.));
|
||||
path.curve_to(bounds.lower_right(), bounds.upper_right());
|
||||
path.line_to(bounds.lower_left());
|
||||
scene.push_path(path.build(self.color, None));
|
||||
cx.scene().push_path(path.build(self.color, None));
|
||||
}
|
||||
|
||||
fn rect_for_text_range(
|
||||
|
|
|
@ -7,7 +7,7 @@ use gpui::{
|
|||
},
|
||||
json::ToJson,
|
||||
serde_json::{self, json},
|
||||
AnyElement, Axis, Element, LayoutContext, PaintContext, SceneBuilder, View, ViewContext,
|
||||
AnyElement, Axis, Element, View, ViewContext,
|
||||
};
|
||||
|
||||
pub(crate) struct FacePile<V: View> {
|
||||
|
@ -32,7 +32,7 @@ impl<V: View> Element<V> for FacePile<V> {
|
|||
&mut self,
|
||||
constraint: gpui::SizeConstraint,
|
||||
view: &mut V,
|
||||
cx: &mut LayoutContext<V>,
|
||||
cx: &mut ViewContext<V>,
|
||||
) -> (Vector2F, Self::LayoutState) {
|
||||
debug_assert!(constraint.max_along(Axis::Horizontal) == f32::INFINITY);
|
||||
|
||||
|
@ -53,12 +53,11 @@ impl<V: View> Element<V> for FacePile<V> {
|
|||
|
||||
fn paint(
|
||||
&mut self,
|
||||
scene: &mut SceneBuilder,
|
||||
bounds: RectF,
|
||||
visible_bounds: RectF,
|
||||
_layout: &mut Self::LayoutState,
|
||||
view: &mut V,
|
||||
cx: &mut PaintContext<V>,
|
||||
cx: &mut ViewContext<V>,
|
||||
) -> Self::PaintState {
|
||||
let visible_bounds = bounds.intersection(visible_bounds).unwrap_or_default();
|
||||
|
||||
|
@ -69,9 +68,10 @@ impl<V: View> Element<V> for FacePile<V> {
|
|||
let size = face.size();
|
||||
origin_x -= size.x();
|
||||
let origin_y = origin_y + (bounds.height() - size.y()) / 2.0;
|
||||
scene.paint_layer(None, |scene| {
|
||||
face.paint(scene, vec2f(origin_x, origin_y), visible_bounds, view, cx);
|
||||
});
|
||||
|
||||
cx.scene().push_layer(None);
|
||||
face.paint(vec2f(origin_x, origin_y), visible_bounds, view, cx);
|
||||
cx.scene().pop_layer();
|
||||
origin_x += self.overlap;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue