Clean up some LTN code from when the concept of 3 per-neighborhood tabs was stronger. [rebuild]

This commit is contained in:
Dustin Carlino 2022-03-16 12:53:20 +00:00
parent 36ef6d6b34
commit 25ebb627be

View File

@ -87,32 +87,30 @@ impl Tab {
"Adjust boundary" => Some(Transition::Replace(
crate::select_boundary::SelectBoundary::new_state(ctx, app, id),
)),
"Connectivity" => Some(Tab::Connectivity.switch_to_state(ctx, app, id)),
"Rat runs" => Some(Tab::RatRuns.switch_to_state(ctx, app, id)),
"Connectivity" => Some(Transition::Replace(crate::connectivity::Viewer::new_state(
ctx, app, id,
))),
"Rat runs" => Some(Transition::Replace(
crate::rat_run_viewer::BrowseRatRuns::new_state(ctx, app, id, None),
)),
"undo" => {
let prev = app.session.modal_filters.previous_version.take().unwrap();
app.session.modal_filters = prev;
after_edit(ctx, app);
// Recreate the current state. This will reset any panel state (checkboxes and
// dropdowns)
Some(self.switch_to_state(ctx, app, id))
Some(Transition::Replace(match self {
Tab::Connectivity => crate::connectivity::Viewer::new_state(ctx, app, id),
// TODO Preserve the current rat run
Tab::RatRuns => {
crate::rat_run_viewer::BrowseRatRuns::new_state(ctx, app, id, None)
}
}))
}
_ => None,
}
}
pub fn switch_to_state(
self,
ctx: &mut EventCtx,
app: &mut App,
id: NeighborhoodID,
) -> Transition {
Transition::Replace(match self {
Tab::Connectivity => crate::connectivity::Viewer::new_state(ctx, app, id),
Tab::RatRuns => crate::rat_run_viewer::BrowseRatRuns::new_state(ctx, app, id, None),
})
}
fn make_buttons(self, ctx: &mut EventCtx) -> Widget {
let mut row = Vec::new();
for (tab, label, key) in [