mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 20:25:06 +00:00
- hide::shown reads ShellCx::panels_hidden: the host's Except stays, any other hide hides every panel; a hidden dock (Tab) hides every panel. The columns no longer skip themselves on the shell's dock visibility. - DockTo::Docked tries the dock columns' groups, then the docked tree's, as tabs, and takes the first the model takes under the permissions (drop::takes), so a toolbar's group is passed over. - DockSizes::title_row is FloatingGroup's title row height; the window commands' source, stepped window heights and FloatSpace::title_row use it. - Trials: hidden.rs, dock_back.rs, and the window group under the area's title row in floating_area.rs.
37 lines
1.8 KiB
Rust
37 lines
1.8 KiB
Rust
//! The hidden-panel prune of a dock area: what the host hides, the shell's panel visibility and Maximize Frame
|
|
//! decide which panels the area shows.
|
|
|
|
use crate::docking::HidePanels;
|
|
use crate::docking::frame::{FrameView, maximize};
|
|
use crate::runtime::env::ShellCx;
|
|
use craft_behavior::dock::Layout;
|
|
use std::hash::Hash;
|
|
|
|
/// The layout as the area shows it, and whether its floating windows show.
|
|
pub(super) struct Shown<'a, P: Clone> {
|
|
/// The pruned layout with its write-back map.
|
|
pub(super) view: FrameView<'a, P>,
|
|
/// Floating windows show: the shell shows them, or it hides the panels and the view keeps what the host names.
|
|
pub(super) floating: bool,
|
|
}
|
|
|
|
/// `layout` with the host's `hide`, the shell's panel visibility and the frame of `maximized` applied. Protected
|
|
/// panels always stay, so a canvas shows while the dock is hidden. While the shell hides the panels and keeps the
|
|
/// tools (Shift+Tab), the panels the host's `HidePanels::Except` names stay, docked or floating, and every other panel
|
|
/// hides; while the shell hides the dock (Tab, body-only mode), every panel hides. Size edits made on the view go back
|
|
/// through `FrameView::write_back`.
|
|
pub(super) fn shown<'a, P: Clone + Eq + Hash>(
|
|
layout: &'a Layout<P>,
|
|
maximized: Option<&P>,
|
|
hide: HidePanels<'_, P>,
|
|
shell: Option<&ShellCx>,
|
|
protected: &dyn Fn(&P) -> bool,
|
|
) -> Shown<'a, P> {
|
|
let (hide, floating) = match shell {
|
|
None => (hide, true),
|
|
Some(shell) if shell.panels_hidden() => (if let HidePanels::Except(keep) = hide { HidePanels::Except(keep) } else { HidePanels::All }, true),
|
|
Some(shell) => (if shell.dock_visible() { hide } else { HidePanels::All }, shell.floating_visible()),
|
|
};
|
|
Shown { view: maximize(layout, maximized, hide, protected), floating }
|
|
}
|