mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 19:08:00 +03:00
Revert changes to gpui2
crate
This commit is contained in:
parent
f6a4151f60
commit
a4bde421db
@ -160,15 +160,6 @@ pub fn black() -> Hsla {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn white() -> Hsla {
|
||||
Hsla {
|
||||
h: 0.,
|
||||
s: 0.,
|
||||
l: 1.,
|
||||
a: 1.,
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Rgba> for Hsla {
|
||||
fn from(color: Rgba) -> Self {
|
||||
let r = color.r;
|
||||
|
@ -12,21 +12,11 @@ use parking_lot::Mutex;
|
||||
use std::sync::Arc;
|
||||
use util::arc_cow::ArcCow;
|
||||
|
||||
impl<V: 'static> IntoElement<V> for ArcCow<'static, str> {
|
||||
impl<V: 'static, S: Into<ArcCow<'static, str>>> IntoElement<V> for S {
|
||||
type Element = Text;
|
||||
|
||||
fn into_element(self) -> Self::Element {
|
||||
Text { text: self }
|
||||
}
|
||||
}
|
||||
|
||||
impl<V: 'static> IntoElement<V> for &'static str {
|
||||
type Element = Text;
|
||||
|
||||
fn into_element(self) -> Self::Element {
|
||||
Text {
|
||||
text: ArcCow::from(self),
|
||||
}
|
||||
Text { text: self.into() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ pub mod interactive;
|
||||
pub mod style;
|
||||
pub mod view;
|
||||
pub mod view_context;
|
||||
pub mod view_handle;
|
||||
|
||||
pub use color::*;
|
||||
pub use element::{AnyElement, Element, IntoElement, Layout, ParentElement};
|
||||
|
@ -22,8 +22,6 @@ use gpui2_macros::styleable_helpers;
|
||||
use refineable::{Refineable, RefinementCascade};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub type StyleCascade = RefinementCascade<Style>;
|
||||
|
||||
#[derive(Clone, Refineable, Debug)]
|
||||
#[refineable(debug)]
|
||||
pub struct Style {
|
||||
@ -131,7 +129,7 @@ impl Style {
|
||||
color: self.text_color.map(Into::into),
|
||||
font_family: self.font_family.clone(),
|
||||
font_size: self.font_size.map(|size| size * cx.rem_size()),
|
||||
font_weight: self.font_weight.map(Into::into),
|
||||
font_weight: self.font_weight,
|
||||
font_style: self.font_style,
|
||||
underline: None,
|
||||
})
|
||||
|
@ -3,10 +3,7 @@ use std::{any::TypeId, rc::Rc};
|
||||
use crate::{element::LayoutId, style::Style};
|
||||
use anyhow::{anyhow, Result};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use gpui::{
|
||||
geometry::Size, scene::EventHandler, AnyWindowHandle, BorrowWindowContext, EventContext,
|
||||
Layout, MeasureParams, WindowContext,
|
||||
};
|
||||
use gpui::{geometry::Size, scene::EventHandler, EventContext, Layout, MeasureParams};
|
||||
pub use gpui::{taffy::tree::NodeId, ViewContext as LegacyViewContext};
|
||||
|
||||
#[derive(Deref, DerefMut)]
|
||||
@ -80,35 +77,3 @@ impl<'a, 'b, 'c, V: 'static> ViewContext<'a, 'b, 'c, V> {
|
||||
.computed_layout(layout_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'c, V: 'static> BorrowWindowContext for ViewContext<'a, 'b, 'c, V> {
|
||||
type Result<T> = T;
|
||||
|
||||
fn read_window<T, F>(&self, window: AnyWindowHandle, f: F) -> Self::Result<T>
|
||||
where
|
||||
F: FnOnce(&WindowContext) -> T,
|
||||
{
|
||||
self.legacy_cx.read_window(window, f)
|
||||
}
|
||||
|
||||
fn read_window_optional<T, F>(&self, window: AnyWindowHandle, f: F) -> Option<T>
|
||||
where
|
||||
F: FnOnce(&WindowContext) -> Option<T>,
|
||||
{
|
||||
self.legacy_cx.read_window_optional(window, f)
|
||||
}
|
||||
|
||||
fn update_window<T, F>(&mut self, window: AnyWindowHandle, f: F) -> Self::Result<T>
|
||||
where
|
||||
F: FnOnce(&mut WindowContext) -> T,
|
||||
{
|
||||
self.legacy_cx.update_window(window, f)
|
||||
}
|
||||
|
||||
fn update_window_optional<T, F>(&mut self, window: AnyWindowHandle, f: F) -> Option<T>
|
||||
where
|
||||
F: FnOnce(&mut WindowContext) -> Option<T>,
|
||||
{
|
||||
self.legacy_cx.update_window_optional(window, f)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user