Add back splitting
This commit is contained in:
parent
faf93aed4e
commit
e905ababcd
3 changed files with 38 additions and 17 deletions
|
@ -125,10 +125,6 @@ pub fn init(cx: &mut AppContext) {
|
||||||
// cx.add_async_action(Pane::close_items_to_the_left);
|
// cx.add_async_action(Pane::close_items_to_the_left);
|
||||||
// cx.add_async_action(Pane::close_items_to_the_right);
|
// cx.add_async_action(Pane::close_items_to_the_right);
|
||||||
// cx.add_async_action(Pane::close_all_items);
|
// cx.add_async_action(Pane::close_all_items);
|
||||||
// cx.add_action(|pane: &mut Pane, _: &SplitLeft, cx| pane.split(SplitDirection::Left, cx));
|
|
||||||
// cx.add_action(|pane: &mut Pane, _: &SplitUp, cx| pane.split(SplitDirection::Up, cx));
|
|
||||||
// cx.add_action(|pane: &mut Pane, _: &SplitRight, cx| pane.split(SplitDirection::Right, cx));
|
|
||||||
// cx.add_action(|pane: &mut Pane, _: &SplitDown, cx| pane.split(SplitDirection::Down, cx));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
|
@ -1195,9 +1191,9 @@ impl Pane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn split(&mut self, direction: SplitDirection, cx: &mut ViewContext<Self>) {
|
pub fn split(&mut self, direction: SplitDirection, cx: &mut ViewContext<Self>) {
|
||||||
// cx.emit(Event::Split(direction));
|
cx.emit(Event::Split(direction));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// fn deploy_split_menu(&mut self, cx: &mut ViewContext<Self>) {
|
// fn deploy_split_menu(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
// self.tab_bar_context_menu.handle.update(cx, |menu, cx| {
|
// self.tab_bar_context_menu.handle.update(cx, |menu, cx| {
|
||||||
|
@ -1903,10 +1899,6 @@ impl Pane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Entity for Pane {
|
|
||||||
// type Event = Event;
|
|
||||||
// }
|
|
||||||
|
|
||||||
impl Render for Pane {
|
impl Render for Pane {
|
||||||
type Element = Focusable<Self, Div<Self>>;
|
type Element = Focusable<Self, Div<Self>>;
|
||||||
|
|
||||||
|
@ -1914,6 +1906,10 @@ impl Render for Pane {
|
||||||
v_stack()
|
v_stack()
|
||||||
.key_context("Pane")
|
.key_context("Pane")
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle)
|
||||||
|
.on_action(|pane: &mut Pane, _: &SplitLeft, cx| pane.split(SplitDirection::Left, cx))
|
||||||
|
.on_action(|pane: &mut Pane, _: &SplitUp, cx| pane.split(SplitDirection::Up, cx))
|
||||||
|
.on_action(|pane: &mut Pane, _: &SplitRight, cx| pane.split(SplitDirection::Right, cx))
|
||||||
|
.on_action(|pane: &mut Pane, _: &SplitDown, cx| pane.split(SplitDirection::Down, cx))
|
||||||
.size_full()
|
.size_full()
|
||||||
.on_action(|pane: &mut Self, action, cx| {
|
.on_action(|pane: &mut Self, action, cx| {
|
||||||
pane.close_active_item(action, cx)
|
pane.close_active_item(action, cx)
|
||||||
|
|
|
@ -551,7 +551,32 @@ impl PaneAxis {
|
||||||
) -> AnyElement<Workspace> {
|
) -> AnyElement<Workspace> {
|
||||||
debug_assert!(self.members.len() == self.flexes.lock().len());
|
debug_assert!(self.members.len() == self.flexes.lock().len());
|
||||||
|
|
||||||
todo!()
|
div()
|
||||||
|
.flex()
|
||||||
|
.flex_auto()
|
||||||
|
.map(|s| match self.axis {
|
||||||
|
Axis::Vertical => s.flex_col(),
|
||||||
|
Axis::Horizontal => s.flex_row(),
|
||||||
|
})
|
||||||
|
.children(self.members.iter().enumerate().map(|(ix, member)| {
|
||||||
|
match member {
|
||||||
|
Member::Axis(axis) => axis
|
||||||
|
.render(
|
||||||
|
project,
|
||||||
|
basis,
|
||||||
|
follower_states,
|
||||||
|
active_call,
|
||||||
|
active_pane,
|
||||||
|
zoomed,
|
||||||
|
app_state,
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
.render(),
|
||||||
|
Member::Pane(pane) => pane.clone().render(),
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.render()
|
||||||
|
|
||||||
// let mut pane_axis = PaneAxisElement::new(
|
// let mut pane_axis = PaneAxisElement::new(
|
||||||
// self.axis,
|
// self.axis,
|
||||||
// basis,
|
// basis,
|
||||||
|
|
|
@ -36,11 +36,11 @@ use futures::{
|
||||||
Future, FutureExt, StreamExt,
|
Future, FutureExt, StreamExt,
|
||||||
};
|
};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, div, point, prelude::*, register_action, rems, size, Action, AnyModel, AnyView,
|
actions, div, point, prelude::*, rems, size, Action, AnyModel, AnyView, AnyWeakView,
|
||||||
AnyWeakView, AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity,
|
AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity, EntityId,
|
||||||
EntityId, EventEmitter, GlobalPixels, KeyContext, Model, ModelContext, ParentComponent, Point,
|
EventEmitter, GlobalPixels, KeyContext, Model, ModelContext, ParentComponent, Point, Render,
|
||||||
Render, Size, Styled, Subscription, Task, View, ViewContext, WeakView, WindowBounds,
|
Size, Styled, Subscription, Task, View, ViewContext, WeakView, WindowBounds, WindowContext,
|
||||||
WindowContext, WindowHandle, WindowOptions,
|
WindowHandle, WindowOptions,
|
||||||
};
|
};
|
||||||
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
|
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue