Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalized slice layout engine #737

Merged
merged 67 commits into from
Dec 25, 2023

Conversation

dalyIsaac
Copy link
Owner

@dalyIsaac dalyIsaac commented Dec 23, 2023

This PR adds a generalized SliceLayoutEngine, via the SliceLayoutPlugin.

SliceLayoutEngine is a layout engine that internally stores an ordered list of IWindows. The monitor is divided into a number of IAreas. Each IArea corresponds to a "slice" of the IWindow list.

    context.WorkspaceManager.CreateLayoutEngines = () => new CreateLeafLayoutEngine[]
    {
        (id) => new SliceLayoutEngine(
            context,
            sliceLayoutPlugin,
            id,
            new ParentArea(
                isRow: true, 
                (0.5, new OverflowArea()), 
                (0.5, new SliceArea(order: 0, maxChildren: 2))
            )
        ) { Name = "Overflow on left" },

        (id) => new SliceLayoutEngine(
            context,
            sliceLayoutPlugin,
            id,
            new ParentArea(
                isRow: true, 
                (0.5, new SliceArea(order: 0, maxChildren: 1)), 
                (0.25, new OverflowArea()), (0.25, new OverflowArea())
            )
        ) { Name = "Multiple overflows"},
        
        (id) => SliceLayouts.CreateMultiColumnLayout(context, sliceLayoutPlugin, id, 1, 2, 0),
        (id) => SliceLayouts.CreatePrimaryStackLayout(context, sliceLayoutPlugin, id)
    };

There are three types of IAreas:

  • ParentArea: An area that can have any IArea implementation as a child
  • SliceArea: An ordered area that can have any IWindow as a child. There can be multiple SliceAreas in a SliceLayoutEngine, and they are ordered by the Order property/parameter.
  • OverflowArea: An area that can have any infinite number of IWindows as a child. There can be only one OverflowArea in a SliceLayoutEngine - any additional OverflowAreas will be ignored. OverflowAreas implicitly are the last area in the layout engine, in comparison to all SliceAreas.

The SliceLayouts contains methods to create a few common layouts:

  • primary/stack (master/stack)
  • multi-column layout
  • three-column layout, with the middle column being the primary

@dalyIsaac dalyIsaac added enhancement New feature or request plugin idea An idea for a new plugin labels Dec 23, 2023
@dalyIsaac dalyIsaac linked an issue Dec 23, 2023 that may be closed by this pull request
@dalyIsaac dalyIsaac force-pushed the 634-generalized-master-stack-layout-engine branch from 192ce16 to 6c3f689 Compare December 23, 2023 02:17
@dalyIsaac dalyIsaac marked this pull request as ready for review December 25, 2023 10:07
@dalyIsaac dalyIsaac changed the title DRAFT: Generalized slice layout engine Generalized slice layout engine Dec 25, 2023
@dalyIsaac dalyIsaac merged commit cc98566 into main Dec 25, 2023
6 checks passed
@dalyIsaac dalyIsaac deleted the 634-generalized-master-stack-layout-engine branch December 25, 2023 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin idea An idea for a new plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generalized master-stack layout engine
1 participant