Remove last stale code

This commit is contained in:
Mikayla 2024-01-12 20:59:19 -08:00
parent 5897b18cfd
commit bfb59f1598
No known key found for this signature in database
9 changed files with 2 additions and 253 deletions

View file

@ -809,27 +809,6 @@ pub mod test {
Edit,
}
// impl Clone for TestItem {
// fn clone(&self) -> Self {
// Self {
// state: self.state.clone(),
// label: self.label.clone(),
// save_count: self.save_count,
// save_as_count: self.save_as_count,
// reload_count: self.reload_count,
// is_dirty: self.is_dirty,
// is_singleton: self.is_singleton,
// has_conflict: self.has_conflict,
// project_items: self.project_items.clone(),
// nav_history: None,
// tab_descriptions: None,
// tab_detail: Default::default(),
// workspace_id: self.workspace_id,
// focus_handle: self.focus_handle.clone(),
// }
// }
// }
impl TestProjectItem {
pub fn new(id: u64, path: &str, cx: &mut AppContext) -> Model<Self> {
let entry_id = Some(ProjectEntryId::from_proto(id));

View file

@ -60,24 +60,6 @@ pub enum SaveIntent {
#[derive(Clone, Deserialize, PartialEq, Debug)]
pub struct ActivateItem(pub usize);
// #[derive(Clone, PartialEq)]
// pub struct CloseItemById {
// pub item_id: usize,
// pub pane: WeakView<Pane>,
// }
// #[derive(Clone, PartialEq)]
// pub struct CloseItemsToTheLeftById {
// pub item_id: usize,
// pub pane: WeakView<Pane>,
// }
// #[derive(Clone, PartialEq)]
// pub struct CloseItemsToTheRightById {
// pub item_id: usize,
// pub pane: WeakView<Pane>,
// }
#[derive(Clone, PartialEq, Debug, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CloseActiveItem {
@ -1226,125 +1208,6 @@ impl Pane {
cx.emit(Event::Split(direction));
}
// fn deploy_split_menu(&mut self, cx: &mut ViewContext<Self>) {
// self.tab_bar_context_menu.handle.update(cx, |menu, cx| {
// menu.toggle(
// Default::default(),
// AnchorCorner::TopRight,
// vec![
// ContextMenuItem::action("Split Right", SplitRight),
// ContextMenuItem::action("Split Left", SplitLeft),
// ContextMenuItem::action("Split Up", SplitUp),
// ContextMenuItem::action("Split Down", SplitDown),
// ],
// cx,
// );
// });
// self.tab_bar_context_menu.kind = TabBarContextMenuKind::Split;
// }
// fn deploy_new_menu(&mut self, cx: &mut ViewContext<Self>) {
// self.tab_bar_context_menu.handle.update(cx, |menu, cx| {
// menu.toggle(
// Default::default(),
// AnchorCorner::TopRight,
// vec![
// ContextMenuItem::action("New File", NewFile),
// ContextMenuItem::action("New Terminal", NewCenterTerminal),
// ContextMenuItem::action("New Search", NewSearch),
// ],
// cx,
// );
// });
// self.tab_bar_context_menu.kind = TabBarContextMenuKind::New;
// }
// fn deploy_tab_context_menu(
// &mut self,
// position: Vector2F,
// target_item_id: usize,
// cx: &mut ViewContext<Self>,
// ) {
// let active_item_id = self.items[self.active_item_index].id();
// let is_active_item = target_item_id == active_item_id;
// let target_pane = cx.weak_handle();
// // The `CloseInactiveItems` action should really be called "CloseOthers" and the behaviour should be dynamically based on the tab the action is ran on. Currently, this is a weird action because you can run it on a non-active tab and it will close everything by the actual active tab
// self.tab_context_menu.update(cx, |menu, cx| {
// menu.show(
// position,
// AnchorCorner::TopLeft,
// if is_active_item {
// vec![
// ContextMenuItem::action(
// "Close Active Item",
// CloseActiveItem { save_intent: None },
// ),
// ContextMenuItem::action("Close Inactive Items", CloseInactiveItems),
// ContextMenuItem::action("Close Clean Items", CloseCleanItems),
// ContextMenuItem::action("Close Items To The Left", CloseItemsToTheLeft),
// ContextMenuItem::action("Close Items To The Right", CloseItemsToTheRight),
// ContextMenuItem::action(
// "Close All Items",
// CloseAllItems { save_intent: None },
// ),
// ]
// } else {
// // In the case of the user right clicking on a non-active tab, for some item-closing commands, we need to provide the id of the tab, for the others, we can reuse the existing command.
// vec![
// ContextMenuItem::handler("Close Inactive Item", {
// let pane = target_pane.clone();
// move |cx| {
// if let Some(pane) = pane.upgrade(cx) {
// pane.update(cx, |pane, cx| {
// pane.close_item_by_id(
// target_item_id,
// SaveIntent::Close,
// cx,
// )
// .detach_and_log_err(cx);
// })
// }
// }
// }),
// ContextMenuItem::action("Close Inactive Items", CloseInactiveItems),
// ContextMenuItem::action("Close Clean Items", CloseCleanItems),
// ContextMenuItem::handler("Close Items To The Left", {
// let pane = target_pane.clone();
// move |cx| {
// if let Some(pane) = pane.upgrade(cx) {
// pane.update(cx, |pane, cx| {
// pane.close_items_to_the_left_by_id(target_item_id, cx)
// .detach_and_log_err(cx);
// })
// }
// }
// }),
// ContextMenuItem::handler("Close Items To The Right", {
// let pane = target_pane.clone();
// move |cx| {
// if let Some(pane) = pane.upgrade(cx) {
// pane.update(cx, |pane, cx| {
// pane.close_items_to_the_right_by_id(target_item_id, cx)
// .detach_and_log_err(cx);
// })
// }
// }
// }),
// ContextMenuItem::action(
// "Close All Items",
// CloseAllItems { save_intent: None },
// ),
// ]
// },
// cx,
// );
// });
// }
pub fn toolbar(&self) -> &View<Toolbar> {
&self.toolbar
}

View file

@ -1,5 +1,3 @@
//#![allow(dead_code)]
pub mod model;
use std::path::Path;

View file

@ -3324,36 +3324,6 @@ impl Workspace {
workspace
}
// fn render_dock(&self, position: DockPosition, cx: &WindowContext) -> Option<AnyElement<Self>> {
// let dock = match position {
// DockPosition::Left => &self.left_dock,
// DockPosition::Right => &self.right_dock,
// DockPosition::Bottom => &self.bottom_dock,
// };
// let active_panel = dock.read(cx).visible_panel()?;
// let element = if Some(active_panel.id()) == self.zoomed.as_ref().map(|zoomed| zoomed.id()) {
// dock.read(cx).render_placeholder(cx)
// } else {
// ChildView::new(dock, cx).into_any()
// };
// Some(
// element
// .constrained()
// .dynamically(move |constraint, _, cx| match position {
// DockPosition::Left | DockPosition::Right => SizeConstraint::new(
// Vector2F::new(20., constraint.min.y()),
// Vector2F::new(cx.window_size().x() * 0.8, constraint.max.y()),
// ),
// DockPosition::Bottom => SizeConstraint::new(
// Vector2F::new(constraint.min.x(), 20.),
// Vector2F::new(constraint.max.x(), cx.window_size().y() * 0.8),
// ),
// })
// .into_any(),
// )
// }
// }
pub fn register_action<A: Action>(
&mut self,
callback: impl Fn(&mut Self, &A, &mut ViewContext<Self>) + 'static,