Fix last thing

This commit is contained in:
Conrad Irwin 2023-11-20 16:35:56 -07:00
parent 5c0f2e75ea
commit 8049ec674e
4 changed files with 19 additions and 25 deletions

View file

@ -63,7 +63,6 @@ pub struct SendKeystroke(String);
actions!(Clear, Copy, Paste, ShowCharacterPalette, SearchTest);
pub fn init(cx: &mut AppContext) {
workspace::ui::init(cx);
terminal_panel::init(cx);
terminal::init(cx);

View file

@ -1,8 +1,9 @@
use gpui::{div, AnyElement, ClickEvent, Div, RenderOnce, Stateful, StatefulInteractiveElement};
use gpui::{
div, px, AnyElement, ClickEvent, Div, RenderOnce, Stateful, StatefulInteractiveElement,
};
use smallvec::SmallVec;
use std::rc::Rc;
use crate::settings::user_settings;
use crate::{
disclosure_control, h_stack, v_stack, Avatar, Icon, IconElement, IconSize, Label, Toggle,
};
@ -331,8 +332,6 @@ impl Component for ListItem {
type Rendered = Stateful<Div>;
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
let settings = user_settings(cx);
let left_content = match self.left_slot.clone() {
Some(GraphicSlot::Icon(i)) => Some(
h_stack().child(
@ -377,7 +376,7 @@ impl Component for ListItem {
// .ml(rems(0.75 * self.indent_level as f32))
.children((0..self.indent_level).map(|_| {
div()
.w(*settings.list_indent_depth)
.w(px(4.))
.h_full()
.flex()
.justify_center()

View file

@ -1,8 +1,8 @@
use gpui::px;
use gpui::{prelude::*, AbsoluteLength, AnyElement, Div, RenderOnce};
use smallvec::SmallVec;
use crate::prelude::*;
use crate::settings::user_settings;
use crate::v_stack;
#[derive(Default, Debug, PartialEq, Eq, Hash, Clone, Copy)]
@ -75,13 +75,11 @@ impl Component for Panel {
impl Panel {
pub fn new(id: impl Into<ElementId>, cx: &mut WindowContext) -> Self {
let settings = user_settings(cx);
Self {
id: id.into(),
current_side: PanelSide::default(),
allowed_sides: PanelAllowedSides::default(),
initial_width: *settings.default_panel_size,
initial_width: px(320.).into(),
width: None,
children: SmallVec::new(),
}

View file

@ -8,7 +8,9 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use theme2::ActiveTheme;
use ui::{h_stack, menu_handle, ContextMenu, IconButton, InteractionState, Tooltip};
use ui::{
h_stack, menu_handle, ContextMenu, IconButton, InteractionState, Label, ListItem, Tooltip,
};
pub enum PanelEvent {
ChangePosition,
@ -711,25 +713,21 @@ impl Render for PanelButtons {
DockPosition::Bottom,
];
//CX: Pane
ContextMenu::build(cx, |mut menu, cx| {
// CX: Menu
for position in POSITIONS {
if position != dock_position
&& panel.position_is_valid(position, cx)
{
// let panel = panel.clone();
todo!()
// menu = menu.entry(
// ListEntry::new(Label::new(format!(
// "Dock {}",
// position.to_label()
// ))),
// cx.listener(move |_, cx| {
// //What should CX be? CX: Pane
// panel.set_position(position, cx);
// }),
//)
let panel = panel.clone();
menu = menu.entry(
ListItem::new(
panel.entity_id(),
Label::new(format!("Dock {}", position.to_label())),
),
move |_, cx| {
panel.set_position(position, cx);
},
)
}
}
menu